Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions bindings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,29 @@ func TestFunctionParameters(t *testing.T) {
})
}

func TestSpreadOperator(t *testing.T) {
runDBTest(t, func(dbt *DBTest) {
dbt.mustExec("CREATE TABLE spread_operator_test (id INTEGER)")
defer dbt.mustExec("DROP TABLE IF EXISTS spread_operator_test")
dbt.mustExec("INSERT INTO spread_operator_test VALUES (?)", 1)
dbt.mustExec("INSERT INTO spread_operator_test VALUES (?)", 2)
rows := dbt.mustQuery("SELECT * FROM spread_operator_test WHERE id IN (**?)", []int{1, 2, 3})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a suggestion - using "SELECT COUNT(*)" instead might might cut the unit test by a couple of lines.

defer rows.Close()
cnt := 0
for rows.Next() {
cnt++
}
assertEqualE(t, cnt, 2)
rows2 := dbt.mustQuery("SELECT * FROM spread_operator_test WHERE id IN (**?)", []int{1, 4, 5})
defer rows2.Close()
cnt = 0
for rows2.Next() {
cnt++
}
assertEqualE(t, cnt, 1)
})
}

func TestVariousBindingModes(t *testing.T) {
testcases := []struct {
testDesc string
Expand Down
Loading