From d01c914e7f2cd4333cadae13455ef013428f493c Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Tue, 29 Sep 2026 09:36:14 +0200 Subject: [PATCH] Assert prove, stepInto and columnItems panic on an unhandled node, and a bare table read is refused as a row --- render_test.go | 3 +++ table_test.go | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/render_test.go b/render_test.go index 4aa67ae..8f0e5cd 100644 --- a/render_test.go +++ b/render_test.go @@ -61,10 +61,13 @@ func (*unhandledNode) isNode() {} func TestNodeSwitchesPanicOnAnUnhandledNode(t *testing.T) { for name, call := range map[string]func(){ + "columnItems": func() { columnItems(&unhandledNode{}) }, "contained": func() { contained(&unhandledNode{}) }, "paths": func() { paths(&unhandledNode{}) }, + "prove": func() { (&valueProof{}).prove(&unhandledNode{}) }, "render": func() { render(nil, &unhandledNode{}, renderScope{}) }, "renderEdges": func() { renderEdges(&unhandledNode{}) }, + "stepInto": func() { _, _ = stepInto(&unhandledNode{}, "x") }, } { mustPanic(t, name, call) } diff --git a/table_test.go b/table_test.go index 98dadc3..8a3d656 100644 --- a/table_test.go +++ b/table_test.go @@ -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) } } + +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) + } + } +}