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:
2026-10-07 23:16:50 +02:00
committed by Lillem4n
parent 0b8dea0d04
commit 49736bd2b6
7 changed files with 62 additions and 27 deletions
+15 -10
View File
@@ -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)
+2 -2
View File
@@ -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")