Assert prove, stepInto and columnItems panic on an unhandled node, and a bare table read is refused as a row
This commit is contained in:
@@ -61,10 +61,13 @@ func (*unhandledNode) isNode() {}
|
|||||||
|
|
||||||
func TestNodeSwitchesPanicOnAnUnhandledNode(t *testing.T) {
|
func TestNodeSwitchesPanicOnAnUnhandledNode(t *testing.T) {
|
||||||
for name, call := range map[string]func(){
|
for name, call := range map[string]func(){
|
||||||
|
"columnItems": func() { columnItems(&unhandledNode{}) },
|
||||||
"contained": func() { contained(&unhandledNode{}) },
|
"contained": func() { contained(&unhandledNode{}) },
|
||||||
"paths": func() { paths(&unhandledNode{}) },
|
"paths": func() { paths(&unhandledNode{}) },
|
||||||
|
"prove": func() { (&valueProof{}).prove(&unhandledNode{}) },
|
||||||
"render": func() { render(nil, &unhandledNode{}, renderScope{}) },
|
"render": func() { render(nil, &unhandledNode{}, renderScope{}) },
|
||||||
"renderEdges": func() { renderEdges(&unhandledNode{}) },
|
"renderEdges": func() { renderEdges(&unhandledNode{}) },
|
||||||
|
"stepInto": func() { _, _ = stepInto(&unhandledNode{}, "x") },
|
||||||
} {
|
} {
|
||||||
mustPanic(t, name, call)
|
mustPanic(t, name, call)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1132,3 +1132,13 @@ func TestCellReadsMeetWhereTheRenderPairsTheRows(t *testing.T) {
|
|||||||
t.Fatalf("New = %v, want 1280's shop and 1281's city kept apart, one draw of municipality rendering one of them", err)
|
t.Fatalf("New = %v, want 1280's shop and 1281's city kept apart, one draw of municipality rendering one of them", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDatatypeRefusesARowRead(t *testing.T) {
|
||||||
|
for _, format := range []string{"{/region}", "{/region[01]}"} {
|
||||||
|
files := with(geo(), map[string]string{"row.json": `{"format":"","col":{"format":"` + format + `","datatype":"integer"}}`})
|
||||||
|
want := `"{name}" renders a row of region, which is composed text`
|
||||||
|
if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, files))); err == nil || !strings.Contains(err.Error(), want) {
|
||||||
|
t.Errorf("%s: New = %v, want an error containing %q", format, err, want)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user