Resolve architect findings: gate [ on json.Valid, fix the root-relative README claim, test isTemplate
Tests / vet + fmt + tests (pull_request) Failing after 16s

This commit is contained in:
2026-09-03 17:40:29 +02:00
parent e08435afa7
commit 031a3ec7d6
3 changed files with 26 additions and 6 deletions
+17
View File
@@ -301,6 +301,23 @@ func TestRunShippedDataByDefault(t *testing.T) {
}
}
func TestIsTemplate(t *testing.T) {
for arg, want := range map[string]bool{
"sv_SE.person": false,
"person.last": false,
"[abc]": false, // a [ can open a real category name; not JSON
"[abc].field": false,
"name: {x}": true, // a { token: a path can never carry a brace
`{"format":"x"}`: true,
`["a","b"]`: true, // a JSON array carries no brace
`[1, 2]`: true,
} {
if got := isTemplate(arg); got != want {
t.Errorf("isTemplate(%q) = %v, want %v", arg, got, want)
}
}
}
func TestRunInlineTemplate(t *testing.T) {
code, out, errb := runOut("--seed", "1", "name: {/sv_SE.person.last}")
if code != 0 || !strings.HasPrefix(out, "name: ") || strings.Contains(out, "{") {