Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09e4e29125 |
@@ -711,13 +711,3 @@ func TestRepeatedBareTokenOfAHeldNameIsRejected(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReadFieldPanicsOnAnUnheldPath(t *testing.T) {
|
|
||||||
tm, ok := compiled(t, `{"format":"{w}","w":{"format":"{x}","x":"1"}}`).(*template)
|
|
||||||
if !ok {
|
|
||||||
t.Fatal("not a template")
|
|
||||||
}
|
|
||||||
mustPanic(t, "unheld arm with a path", func() {
|
|
||||||
readField(engine(1).rand, tm, nil, arm{name: "w.x", key: "w", tail: []string{"x"}, path: "w.x"})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -30,12 +30,11 @@ func TestRepeatedChoiceItemIsRejected(t *testing.T) {
|
|||||||
|
|
||||||
func TestInertObjectIsRejected(t *testing.T) {
|
func TestInertObjectIsRejected(t *testing.T) {
|
||||||
for src, want := range map[string]string{
|
for src, want := range map[string]string{
|
||||||
`{"format":"Malmö"}`: `write "Malmö"`,
|
`{"format":"Malmö"}`: `write "Malmö"`,
|
||||||
`{"format":"{digits(3)}"}`: `write "{digits(3)}"`,
|
`{"format":"{digits(3)}"}`: `write "{digits(3)}"`,
|
||||||
`[{"format":"a","weight":1},"b"]`: "weight 1",
|
`[{"format":"a","weight":1},"b"]`: "weight 1",
|
||||||
`{"format":"{x}","x":"v","repeat":1}`: "repeat 1",
|
`{"format":"{x}","x":"v","repeat":1}`: "repeat 1",
|
||||||
`{"format":"{x}","x":"v","separator":","}`: "separator",
|
`{"format":"{x}","x":"v","separator":","}`: "separator",
|
||||||
`{"format":"{x}","x":"v","repeat":2,"separator":""}`: "default",
|
|
||||||
} {
|
} {
|
||||||
if _, err := compile(parse(t, src)); err == nil || !strings.Contains(err.Error(), want) {
|
if _, err := compile(parse(t, src)); err == nil || !strings.Contains(err.Error(), want) {
|
||||||
t.Errorf("compile(%s) = %v, want an error mentioning %s", src, err, want)
|
t.Errorf("compile(%s) = %v, want an error mentioning %s", src, err, want)
|
||||||
|
|||||||
@@ -51,9 +51,3 @@ func TestTransformArgs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAsciiKeepsDEL(t *testing.T) {
|
|
||||||
if got := mustRender(t, engine(1), `{"format":"{ascii(x)}","x":"a\u007fb"}`); got != "a\u007fb" {
|
|
||||||
t.Errorf("ascii over DEL = %q, want it kept: DEL is ASCII", got)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user