Test that a default written out loads in every position, null outside a column is refused, an alternation reads a field once, and the CLI's lone reference refuses an empty segment
This commit is contained in:
+15
-10
@@ -22,21 +22,26 @@ func grammarLoneReference(text string) (string, bool) {
|
||||
|
||||
func TestLoneReferenceAgreesWithTheGrammar(t *testing.T) {
|
||||
for _, text := range []string{
|
||||
"{/sv_SE.person}",
|
||||
" {/x}",
|
||||
"x",
|
||||
"{.x}",
|
||||
"{/.x}",
|
||||
"{//x}",
|
||||
"{/a...b}",
|
||||
"{/a..b}",
|
||||
"{/a..}",
|
||||
"{/a.[x]}",
|
||||
"{/a.}",
|
||||
"{/a|/b}",
|
||||
"{/a}{/b}",
|
||||
"{/misc.currency[US Dollar (Next day)]}",
|
||||
"{/sv_SE.person}",
|
||||
"{/t[a as b].c}",
|
||||
"{/t[f(x)]}",
|
||||
"{/a}{/b}",
|
||||
"{/x as p}",
|
||||
"{/x(1)}",
|
||||
"{/x}}",
|
||||
"{/}",
|
||||
"{/.x}",
|
||||
" {/x}",
|
||||
"{/a|/b}",
|
||||
"{/x as p}",
|
||||
"{//x}",
|
||||
"{/x(1)}",
|
||||
"{.x}",
|
||||
"x",
|
||||
} {
|
||||
path, lone := loneReference(text)
|
||||
want, wantLone := grammarLoneReference(text)
|
||||
|
||||
@@ -495,8 +495,8 @@ func TestRunTemplateMisuse(t *testing.T) {
|
||||
"42": "number",
|
||||
"42\n": "number",
|
||||
"true\n": "boolean",
|
||||
"null\n": "only null",
|
||||
" null ": "only null",
|
||||
"null\n": `write ""`,
|
||||
" null ": `write ""`,
|
||||
"{//sv_SE.person}": "write {/sv_SE.person}",
|
||||
} {
|
||||
code, out, errb := runOut(stdin, "--seed", "1")
|
||||
|
||||
Reference in New Issue
Block a user