You've already forked go-sqlxmock
mirror of
https://github.com/zhashkevych/go-sqlxmock.git
synced 2025-06-12 21:47:29 +02:00
update and test query whitespace stripping
This commit is contained in:
21
util_test.go
Normal file
21
util_test.go
Normal file
@ -0,0 +1,21 @@
|
||||
package sqlmock
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestQueryStringStripping(t *testing.T) {
|
||||
assert := func(actual, expected string) {
|
||||
if res := stripQuery(actual); res != expected {
|
||||
t.Errorf("Expected '%s' to be '%s', but got '%s'", actual, expected, res)
|
||||
}
|
||||
}
|
||||
|
||||
assert(" SELECT 1", "SELECT 1")
|
||||
assert("SELECT 1 FROM d", "SELECT 1 FROM d")
|
||||
assert(`
|
||||
SELECT c
|
||||
FROM D
|
||||
`, "SELECT c FROM D")
|
||||
assert("UPDATE (.+) SET ", "UPDATE (.+) SET")
|
||||
}
|
Reference in New Issue
Block a user