From b0889faa1474b90cbf273ca60a1a0b43853f776e Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Fri, 25 Sep 2026 08:30:45 +0200 Subject: [PATCH] Want a whole draw nested in another kept apart from the outer draw's other rows, and the probe held over skip-level paths --- table_test.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/table_test.go b/table_test.go index 4e5bf74..8097a17 100644 --- a/table_test.go +++ b/table_test.go @@ -983,7 +983,8 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) { var none pinSet for _, entered := range tables { for row := 0; row < entered.rows(); row++ { - whole := drawAt{drawn: entered, whole: tablePin{entered, row}} + whole := drawAt{drawn: entered} + whole.whole.add(entered, row) s := none.entered(entered, row) for _, cand := range tables { for i := 0; i < 20; i++ { @@ -1002,7 +1003,8 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) { if alternatives(whole, pinned) || alternatives(pinned, whole) { t.Errorf("%s rendered whole is an alternative to %s pinned, though the whole draw ignores the pin", entered.selectorSpelling(row), cand.selectorSpelling(cr)) } - other := drawAt{drawn: cand, whole: tablePin{cand, cr}} + other := drawAt{drawn: cand} + other.whole.add(cand, cr) if want := cand == entered && cr != row; alternatives(whole, other) != want { t.Errorf("alternatives(%s, %s), both rendered whole, = %v, want %v", entered.selectorSpelling(row), cand.selectorSpelling(cr), !want, want) } @@ -1033,6 +1035,8 @@ func TestProbeReportsTheTablesADrawPins(t *testing.T) { "municipality.locality[L4].name", "region", "region.municipality.name", + "region.locality.name", + "region[12].locality.code", "region[12].municipality.locality.code", "region[12].name", } { @@ -1094,4 +1098,14 @@ func TestCellReadsMeetWhereTheRenderPairsTheRows(t *testing.T) { if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, whole)), WithSeed(1)); err == nil || !strings.Contains(err.Error(), "reads a path into") { t.Fatalf("New = %v, want the two drawn rows held to one draw of addr", 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", + "region.tsv": "code\tname\tpopulation\tnote\n01\tStockholms län\t2400000\t-\n12\tSkåne län\t1400000\t-\n14\tVästra Götalands län\t1750000\t-\n", + "shop.json": `{"format":"{name}={note}","rows":"shop.tsv","key":"code","name":"name"}`, + "shop.tsv": "code\tname\tnote\nS1\tKiosk\t{/addr}\nS2\tBod\t-\n", + "x.json": `"{/municipality}"`, + }) + if _, err := New(WithoutShippedData(), WithDataPath(writeFiles(t, nested)), WithSeed(1)); err != nil { + t.Fatalf("New = %v, want 1280's shop and 1281's city kept apart, one draw of municipality rendering one of them", err) + } }