Skip to content

Commit

Permalink
tests: cleanup test/templates and regen expected output
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed Aug 2, 2022
1 parent eef2383 commit abe48b0
Show file tree
Hide file tree
Showing 17 changed files with 29 additions and 17 deletions.
20 changes: 10 additions & 10 deletions test/templates/gen.cue
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ TestGen: #TestGen & {
// Defaults
{
TemplateContent: "Val.a = '{{ .Val.a }}'\n"
Filepath: "\(Outdir)/default.txt"
Filepath: "default.txt"
},
// Alternate delims
{
TemplateContent: "Val.a = '{% .Val.a %}'\n"
Filepath: "\(Outdir)/altdelim.txt"
Filepath: "altdelim.txt"
TemplateDelims: {
LHS: "{%"
RHS: "%}"
Expand All @@ -76,35 +76,35 @@ TestGen: #TestGen & {
// Named things
{
TemplatePath: "named"
Filepath: "\(Outdir)/named-things.txt"
Filepath: "named-things.txt"
},

// File based
{
TemplatePath: "template-file.txt"
Filepath: "\(Outdir)/template-file.txt"
Filepath: "template-file.txt"
},
{
TemplatePath: "template-altfile.txt"
Filepath: "\(Outdir)/template-altfile.txt"
Filepath: "template-altfile.txt"
},

// User file
{
TemplateContent: "User file: '{{ file \"userfile.txt\" }}'\n"
Filepath: "\(Outdir)/user-file.txt"
Filepath: "user-file.txt"
},

for F in _listFiles { F },
for F in mapFiles { F },

{
DatafileFormat: "cue"
Filepath: "\(Outdir)/datafile-cue.cue"
Filepath: "datafile-cue.cue"
},
{
DatafileFormat: "json"
Filepath: "\(Outdir)/datafile-json.json"
Filepath: "datafile-json.json"
Val: #A
},

Expand All @@ -114,7 +114,7 @@ TestGen: #TestGen & {
_listFiles: [ for idx, elem in In.Val.List {
{
TemplatePath: "template-elems.txt"
Filepath: "\(Outdir)/list-elem-\(idx).txt"
Filepath: "list-elem-\(idx).txt"
In: {
Elem: elem
}
Expand All @@ -124,7 +124,7 @@ TestGen: #TestGen & {
mapFiles: [ for key, elem in In.Val.Map {
{
TemplatePath: "template-elems.txt"
Filepath: "\(Outdir)/map-elem-\(key).txt"
Filepath: "map-elem-\(key).txt"
In: {
Elem: elem
}
Expand Down
1 change: 1 addition & 0 deletions test/templates/output/altdelim.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Val.a = 'a'

2 changes: 1 addition & 1 deletion test/templates/output/datafile-cue.cue
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
b: false
n: >0.0
}
}
}
1 change: 1 addition & 0 deletions test/templates/output/datafile-json.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
}
}
}

1 change: 1 addition & 0 deletions test/templates/output/default.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Val.a = 'a'

3 changes: 2 additions & 1 deletion test/templates/output/list-elem-0.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
a:
val: 1
val: 1


3 changes: 2 additions & 1 deletion test/templates/output/list-elem-1.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
b:
val: 2
val: 2


3 changes: 2 additions & 1 deletion test/templates/output/list-elem-2.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
c:
val: 3
val: 3


1 change: 1 addition & 0 deletions test/templates/output/map-elem-a.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val: 1


1 change: 1 addition & 0 deletions test/templates/output/map-elem-b.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val: 2


1 change: 1 addition & 0 deletions test/templates/output/map-elem-c.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
val: 3


2 changes: 1 addition & 1 deletion test/templates/output/named-things.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
embedded template is 'a'
embedded template is 'a'
2 changes: 1 addition & 1 deletion test/templates/output/static-cue.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Hello, I am a static file in cue
Hello, I am a static file in cue
File renamed without changes.
1 change: 1 addition & 0 deletions test/templates/output/template-altfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Hi, I'm a template file on disk 'a'
---
{% camelT "hell-world" %}
---

1 change: 1 addition & 0 deletions test/templates/output/template-file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ Hi, I'm a template file on disk 'a'
---
HellWorld
---

3 changes: 2 additions & 1 deletion test/templates/output/user-file.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
User file: 'ERROR: open userfile.txt: no such file or directory'
User file: 'I'm a userfile used as content in a template
'

0 comments on commit abe48b0

Please sign in to comment.