Skip to content

Commit f205b4c

Browse files
authored
Update bucketby_test.go
1 parent 534073b commit f205b4c

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

bucketby_test.go

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ func TestRemoveByBasic(t *testing.T) {
8181

8282
// After removal, only 2 rows should remain non-nil
8383
count := 0
84-
for _, r := range b.getBy(make(map[int]string)) {
84+
for _, r := range b.all(make(map[int]string)) {
8585
if r != nil {
8686
count++ // non-nil rows
8787
if r[1] == "remove" {
@@ -92,6 +92,32 @@ func TestRemoveByBasic(t *testing.T) {
9292
if count != 2 {
9393
t.Errorf("expected 2 remaining rows, got %d", count)
9494
}
95+
// After removal, only 2 rows should remain non-nil
96+
count = 0
97+
for _, r := range b.getBy(make(map[int]string)) {
98+
if r != nil {
99+
count++ // non-nil rows
100+
if r[1] == "remove" {
101+
t.Errorf("found removed row %v", r)
102+
}
103+
}
104+
}
105+
if count != 0 {
106+
t.Errorf("expected no remaining rows when querying empty map, got %d", count)
107+
}
108+
// After removal, only 2 rows should remain non-nil
109+
count = 0
110+
for _, r := range b.getBy(nil) {
111+
if r != nil {
112+
count++ // non-nil rows
113+
if r[1] == "remove" {
114+
t.Errorf("found removed row %v", r)
115+
}
116+
}
117+
}
118+
if count != 0 {
119+
t.Errorf("expected no remaining rows when querying nil, got %d", count)
120+
}
95121
}
96122

97123
func TestRemoveBy_MultiClause(t *testing.T) {

0 commit comments

Comments
 (0)