diff --git a/reference_test.go b/reference_test.go index 3f5d5a6..da4f750 100644 --- a/reference_test.go +++ b/reference_test.go @@ -275,9 +275,14 @@ func TestReferenceOverlapIsRejected(t *testing.T) { t.Errorf("%s: New = %v, want the overlap rejected", name, err) } } - _, err := New(WithoutShippedData(), WithDataPath(writeData(t, map[string]string{"cat": cat, "row": `{"format":"{a} {b}","a":"{/cat}","b":"{/cat.p.first}"}`}))) - if err == nil || !strings.HasSuffix(err.Error(), "or give {b} a drawGroup") { - t.Errorf("New = %v, want the drawGroup named on the path's field", err) + for row, suffix := range map[string]string{ + `{"format":"{a} {b}","a":"{/cat}","b":"{/cat.p.first}"}`: "or give {b} a drawGroup", + `{"format":"{a}","a":"{/cat} {/cat.p.first}"}`: "name the fields you want instead", + } { + _, err := New(WithoutShippedData(), WithDataPath(writeData(t, map[string]string{"cat": cat, "row": row}))) + if err == nil || !strings.HasSuffix(err.Error(), suffix) { + t.Errorf("New(%s) = %v, want it to end %q", row, err, suffix) + } } // A sibling path and a reference into the level it holds are the same overlap, // and the reference reaches it from a category row renders. diff --git a/table_test.go b/table_test.go index d7b8be5..38a0e86 100644 --- a/table_test.go +++ b/table_test.go @@ -1120,8 +1120,8 @@ func TestCellReadsMeetWhereTheRenderPairsTheRows(t *testing.T) { "region.json": `{"format":"{name}={note}","rows":"region.tsv","key":"code","name":"name","weight":"population"}`, "x.json": `"{/region}|{/municipality}"`, }) - if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, whole)), WithSeed(1)); err == nil || !strings.Contains(err.Error(), "renders its own draw of what") { - t.Fatalf("New = %v, want the two drawn rows held to one draw of addr", err) + if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, whole)), WithSeed(1)); err == nil || !strings.HasSuffix(err.Error(), "or move {/municipality} into a field with a drawGroup") { + t.Fatalf("New = %v, want the two drawn rows held to one draw of addr, and the drawGroup named on a field around the read", err) } nested := with(whole, map[string]string{ "municipality.tsv": "code\tname\tregion\tpopulation\tnote\n0180\tStockholm\t01\t980000\t-\n0184\tSolna\t01\t85000\t-\n1280\tMalmö\t12\t360000\t{/shop}\n1281\tLund\t12\t130000\t{/addr.city}\n1480\tGöteborg\t14\t590000\t-\n",