Skip to content

Commit cd21617

Browse files
committed
[test] correct InterpolateParams parsing
1 parent cdc8f06 commit cd21617

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

connection_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,20 +221,21 @@ func TestInterpolateParamsWithComments(t *testing.T) {
221221
shouldSkip bool
222222
}{
223223
// ? in single-line comment (--) should not be replaced
224-
{"SELECT 1 -- ?\n, ?", []driver.Value{42}, "SELECT 1 -- ?\n, 42", false},
224+
{"SELECT 1 -- ?\n, ?", []driver.Value{int64(42)}, "SELECT 1 -- ?\n, 42", false},
225225
// ? in single-line comment (#) should not be replaced
226-
{"SELECT 1 # ?\n, ?", []driver.Value{42}, "SELECT 1 # ?\n, 42", false},
226+
{"SELECT 1 # ?\n, ?", []driver.Value{int64(42)}, "SELECT 1 # ?\n, 42", false},
227227
// ? in multi-line comment should not be replaced
228-
{"SELECT /* ? */ ?", []driver.Value{42}, "SELECT /* ? */ 42", false},
228+
{"SELECT /* ? */ ?", []driver.Value{int64(42)}, "SELECT /* ? */ 42", false},
229229
// ? in string literal should not be replaced
230-
{"SELECT '?', ?", []driver.Value{42}, "SELECT '?', 42", false},
230+
{"SELECT '?', ?", []driver.Value{int64(42)}, "SELECT '?', 42", false},
231231
// ? in backtick identifier should not be replaced
232-
{"SELECT `?`, ?", []driver.Value{42}, "SELECT `?`, 42", false},
232+
{"SELECT `?`, ?", []driver.Value{int64(42)}, "SELECT `?`, 42", false},
233233
// Multiple comments and real placeholders
234-
{"SELECT ? -- comment ?\n, ? /* ? */ , ? # ?\n, ?", []driver.Value{1, 2, 3}, "SELECT 1 -- comment ?\n, 2 /* ? */ , 3 # ?\n, ?", true},
234+
{"SELECT ? -- comment ?\n, ? /* ? */ , ? # ?\n, ?", []driver.Value{int64(1), int64(2), int64(3)}, "SELECT 1 -- comment ?\n, 2 /* ? */ , 3 # ?\n, ?", true},
235235
}
236236

237237
for i, test := range tests {
238+
238239
q, err := mc.interpolateParams(test.query, test.args)
239240
if test.shouldSkip {
240241
if err != driver.ErrSkip {

0 commit comments

Comments
 (0)