Tests for an empty field name

A field named "" loads, and a bare {} token renders it, but no dot path can
reach it — List hides it and Fake cannot ask for it. {a.} is already rejected
for the same reason, so the two spellings disagree about the same mistake.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
M
2026-08-31 22:07:47 +02:00
committed by lilleman-tw
parent 4b3dd011fc
commit e31e77b8a3
2 changed files with 13 additions and 5 deletions
+7
View File
@@ -120,6 +120,13 @@ func TestNewErrors(t *testing.T) {
map[string]string{"a|b": `["1"]`},
`category "a|b" contains "|"`,
},
// An empty name is reachable by no dot path, so List cannot advertise it and
// Fake cannot ask for it — {} is the one spelling that reaches it, which is
// the same trap {a.} is already rejected for.
"empty field name": {
map[string]string{"a": `{"format":"[{}]","":"VALUE"}`},
`field "" is empty`,
},
"folder name with a paren": {
map[string]string{"a(b/cat": `["1"]`},
`folder "a(b" contains "("`,