Skip to content

Commit 8825a37

Browse files
sfc-gh-pfussfc-gh-mmishchenko
authored andcommitted
NO-SNOW Add spread operator test
1 parent cc7a4a4 commit 8825a37

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

bindings_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,29 @@ func TestFunctionParameters(t *testing.T) {
12641264
})
12651265
}
12661266

1267+
func TestSpreadOperator(t *testing.T) {
1268+
runDBTest(t, func(dbt *DBTest) {
1269+
dbt.mustExec("CREATE TABLE spread_operator_test (id INTEGER)")
1270+
defer dbt.mustExec("DROP TABLE IF EXISTS spread_operator_test")
1271+
dbt.mustExec("INSERT INTO spread_operator_test VALUES (?)", 1)
1272+
dbt.mustExec("INSERT INTO spread_operator_test VALUES (?)", 2)
1273+
rows := dbt.mustQuery("SELECT * FROM spread_operator_test WHERE id IN (**?)", []int{1, 2, 3})
1274+
defer rows.Close()
1275+
cnt := 0
1276+
for rows.Next() {
1277+
cnt++
1278+
}
1279+
assertEqualE(t, cnt, 2)
1280+
rows2 := dbt.mustQuery("SELECT * FROM spread_operator_test WHERE id IN (**?)", []int{1, 4, 5})
1281+
defer rows2.Close()
1282+
cnt = 0
1283+
for rows2.Next() {
1284+
cnt++
1285+
}
1286+
assertEqualE(t, cnt, 1)
1287+
})
1288+
}
1289+
12671290
func TestVariousBindingModes(t *testing.T) {
12681291
testcases := []struct {
12691292
testDesc string

0 commit comments

Comments
 (0)