Want a lone reference whose selector holds a parenthesis refused as a template, and drop the parse test's stale order note
This commit is contained in:
+20
-19
@@ -174,25 +174,26 @@ func TestIsTemplate(t *testing.T) {
|
||||
}
|
||||
}
|
||||
for arg, want := range map[string]string{
|
||||
"[abc]": `starts with "["`,
|
||||
"[abc].field": `starts with "["`,
|
||||
"x[1]y": `"]"`,
|
||||
"x[[1]]": `"["`,
|
||||
"x[]": "empty",
|
||||
"a]b": `holds a "]"`,
|
||||
"a}b": `holds a "}"`,
|
||||
`"abc`: `holds a "\""`,
|
||||
`"a]b`: `holds a "\""`, // the opener the reader typed, not the bracket behind it
|
||||
"{/sv_SE.person.last}": "{/sv_SE.person.last} is the path sv_SE.person.last written as a template; write sv_SE.person.last",
|
||||
`"{/sv_SE.person}"`: "write sv_SE.person",
|
||||
"{.person.last}": "write person.last",
|
||||
"/sv_SE.person": "write sv_SE.person",
|
||||
` "{/sv_SE.person}"`: "write sv_SE.person",
|
||||
`{"format":"{/sv_SE.person}"}`: "write sv_SE.person",
|
||||
"//sv_SE.person": "write sv_SE.person",
|
||||
"{//sv_SE.person}": "{//sv_SE.person} is the path sv_SE.person written as a template; write sv_SE.person",
|
||||
"/sv_SE/person": `path "sv_SE/person" contains "/"`,
|
||||
"{/-}": `path "-" is reserved`,
|
||||
"[abc]": `starts with "["`,
|
||||
"[abc].field": `starts with "["`,
|
||||
"x[1]y": `"]"`,
|
||||
"x[[1]]": `"["`,
|
||||
"x[]": "empty",
|
||||
"a]b": `holds a "]"`,
|
||||
"a}b": `holds a "}"`,
|
||||
`"abc`: `holds a "\""`,
|
||||
`"a]b`: `holds a "\""`, // the opener the reader typed, not the bracket behind it
|
||||
"{/sv_SE.person.last}": "{/sv_SE.person.last} is the path sv_SE.person.last written as a template; write sv_SE.person.last",
|
||||
`"{/sv_SE.person}"`: "write sv_SE.person",
|
||||
"{.person.last}": "write person.last",
|
||||
"/sv_SE.person": "write sv_SE.person",
|
||||
` "{/sv_SE.person}"`: "write sv_SE.person",
|
||||
`{"format":"{/sv_SE.person}"}`: "write sv_SE.person",
|
||||
"//sv_SE.person": "write sv_SE.person",
|
||||
"{//sv_SE.person}": "{//sv_SE.person} is the path sv_SE.person written as a template; write sv_SE.person",
|
||||
"/sv_SE/person": `path "sv_SE/person" contains "/"`,
|
||||
"{/-}": `path "-" is reserved`,
|
||||
"{/misc.currency[US Dollar (Next day)]}": "write misc.currency[US Dollar (Next day)]",
|
||||
} {
|
||||
if _, err := IsTemplate(arg); err == nil || !strings.Contains(err.Error(), want) {
|
||||
t.Errorf("IsTemplate(%q) = %v; want it rejected naming %s", arg, err, want)
|
||||
|
||||
Reference in New Issue
Block a user