Survey tests: reach a table's cells through its own format, the shape New lets through
This commit is contained in:
+2
-2
@@ -109,7 +109,7 @@ func TestReadSurveyWalksACellByEveryRoute(t *testing.T) {
|
|||||||
fsys := fstest.MapFS{
|
fsys := fstest.MapFS{
|
||||||
"g.json": {Data: []byte(`{"format":"{/x.v}","drawGroup":"g2"}`)},
|
"g.json": {Data: []byte(`{"format":"{/x.v}","drawGroup":"g2"}`)},
|
||||||
"r.json": {Data: []byte(`"{/g} {/x}"`)},
|
"r.json": {Data: []byte(`"{/g} {/x}"`)},
|
||||||
"x.json": {Data: []byte(`{"format":"{/g}","rows":"x.tsv","key":"code"}`)},
|
"x.json": {Data: []byte(`{"format":"{v}","rows":"x.tsv","key":"code"}`)},
|
||||||
"x.tsv": {Data: []byte("code\tv\n1\t{/z}\n2\t{/z.a}\n")},
|
"x.tsv": {Data: []byte("code\tv\n1\t{/z}\n2\t{/z.a}\n")},
|
||||||
"z.json": {Data: []byte(`{"format":"{a}","a":"hi"}`)},
|
"z.json": {Data: []byte(`{"format":"{a}","a":"hi"}`)},
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ func TestReadSurveyWalksACellByEveryRoute(t *testing.T) {
|
|||||||
whole = whole || read.at.wholePins.used > 0
|
whole = whole || read.at.wholePins.used > 0
|
||||||
}
|
}
|
||||||
if !pinned || !whole {
|
if !pinned || !whole {
|
||||||
t.Errorf("{/z} gathered under a pinned row %v and a whole read's row %v, want both: {/g} reaches x's cells from the root and from inside {/x}", pinned, whole)
|
t.Errorf("{/z} gathered under a pinned row %v and a whole read's row %v, want both: {/g} reaches x's cells from the root, and {/x} renders them whole", pinned, whole)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1002,7 +1002,7 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) {
|
|||||||
var none pinSet
|
var none pinSet
|
||||||
for _, entered := range tables {
|
for _, entered := range tables {
|
||||||
for row := 0; row < entered.rowCount(); row++ {
|
for row := 0; row < entered.rowCount(); row++ {
|
||||||
whole := surveyAt{wholeTable: entered}
|
whole := surveyAt{}
|
||||||
whole.wholePins.add(entered, row)
|
whole.wholePins.add(entered, row)
|
||||||
s := none.entered(entered, row)
|
s := none.entered(entered, row)
|
||||||
for _, cand := range tables {
|
for _, cand := range tables {
|
||||||
@@ -1022,7 +1022,7 @@ func TestEnteredRowsAgreeWithPinning(t *testing.T) {
|
|||||||
if alternatives(whole, candAt) || alternatives(candAt, whole) {
|
if alternatives(whole, candAt) || alternatives(candAt, 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))
|
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 := surveyAt{wholeTable: cand}
|
other := surveyAt{}
|
||||||
other.wholePins.add(cand, cr)
|
other.wholePins.add(cand, cr)
|
||||||
if want := cand == entered && cr != row; alternatives(whole, other) != want {
|
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)
|
t.Errorf("alternatives(%s, %s), both rendered whole, = %v, want %v", entered.selectorSpelling(row), cand.selectorSpelling(cr), !want, want)
|
||||||
|
|||||||
Reference in New Issue
Block a user