Tests: reusable NewTemplate, and bracket names rejected at load
This commit is contained in:
@@ -275,6 +275,16 @@ func TestNewErrors(t *testing.T) {
|
||||
map[string]string{"a|b": `"1"`},
|
||||
`category "a|b" contains "|"`,
|
||||
},
|
||||
// A bracket is not a token-grammar character, but the CLI reads an argument
|
||||
// starting with [ as a JSON array, so a name carrying one would be misread.
|
||||
"field name with a bracket": {
|
||||
map[string]string{"a": `{"format":"{x}","x":"1","b[c":"2"}`},
|
||||
`field "b[c" contains "["`,
|
||||
},
|
||||
"category name with a bracket": {
|
||||
map[string]string{"[abc]": `"1"`},
|
||||
`category "[abc]" contains "["`,
|
||||
},
|
||||
// An empty name is not a path segment, so List never offered it — while a
|
||||
// bare {}, a trailing dot in Fake("a.") and a {/a.} reference all reached
|
||||
// it. The engine accepted spellings it would never advertise.
|
||||
|
||||
Reference in New Issue
Block a user