1
0
mirror of https://github.com/zhashkevych/go-sqlxmock.git synced 2024-11-24 08:12:13 +02:00
go-sqlxmock/util_test.go

22 lines
454 B
Go

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")
}