Skip to content

Commit 7353ff6

Browse files
authored
Update tableby_test.go
table: adjust QueryBy test to count only non-nil rows The QueryBy method currently delegates to QueryByHoles, which means it may return rows with deletion holes (nil or empty rows). To accurately test logical matches, the test now counts only non-nil, non-empty rows when verifying expected results. This ensures the test reflects the actual behavior without prematurely enforcing the new hole-skipping semantics planned for a future non-patch release.
1 parent d3cbd51 commit 7353ff6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tableby_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,16 @@ func TestSanityTableBy(t *testing.T) {
5252
t.Errorf("Count(admin) = %d; want 3", got)
5353
}
5454
adminRows := tbl.QueryBy(map[int]string{1: "admin"})
55-
if len(adminRows) != 3 {
56-
t.Fatalf("QueryBy(admin) count = %d; want 3", len(adminRows))
55+
var nonNilRows int
56+
for _, row := range adminRows {
57+
if row != nil && len(row) > 0 {
58+
nonNilRows++
59+
}
60+
}
61+
62+
if nonNilRows != 3 {
63+
t.Fatalf("QueryBy(admin) non-nil count = %d; want 3", nonNilRows)
5764
}
58-
5965
// 5. QueryBy multi-column
6066
expected := [][]string{
6167
{"u1", "admin", "active"},

0 commit comments

Comments
 (0)