1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-19 05:09:42 +02:00
documize/vendor/github.com/denisenkom/go-mssqldb/mssql_test.go
2019-06-25 15:37:19 +01:00

39 lines
676 B
Go

package mssql
import (
"context"
"testing"
)
func TestBadOpen(t *testing.T) {
drv := driverWithProcess(t)
_, err := drv.open(context.Background(), "port=bad")
if err == nil {
t.Fail()
}
}
func TestIsProc(t *testing.T) {
list := []struct {
s string
is bool
}{
{"proc", true},
{"select 1;", false},
{"select 1", false},
{"[proc 1]", true},
{"[proc\n1]", false},
{"schema.name", true},
{"[schema].[name]", true},
{"schema.[name]", true},
{"[schema].name", true},
{"schema.[proc name]", true},
}
for _, item := range list {
got := isProc(item.s)
if got != item.is {
t.Errorf("for %q, got %t want %t", item.s, got, item.is)
}
}
}