Skip to content

Commit

Permalink
update test for replacement scan on range
Browse files Browse the repository at this point in the history
  • Loading branch information
ajzo90 committed Jun 5, 2024
1 parent a5aeb3b commit 387c003
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions replacement_scan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestReplacementScan(t *testing.T) {
}
defer connector.Close()

var rangeRows = 3
var rangeRows = 100
RegisterReplacementScan(connector, func(tableName string) (string, []any, error) {
return "range", []any{int64(rangeRows)}, nil
})
Expand All @@ -31,15 +31,19 @@ func TestReplacementScan(t *testing.T) {
}
defer rows.Close()

for rows.Next() {
for i := 0; rows.Next(); i++ {
var val int
require.NoError(t, rows.Scan(&val))
if val != i {
require.Fail(t, "expected %d, got %d", i, val)
}
rangeRows--
}
if rows.Err() != nil {
require.NoError(t, rows.Err())
}

if rangeRows != 0 {
t.Fatalf("expected 0 rows, got %d", rangeRows)
require.Fail(t, "expected 0, got %d", rangeRows)
}

}

0 comments on commit 387c003

Please sign in to comment.