-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsqlite_test.go
More file actions
34 lines (30 loc) · 830 Bytes
/
sqlite_test.go
File metadata and controls
34 lines (30 loc) · 830 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package schema
import (
"testing"
// SQLite driver
_ "github.com/mattn/go-sqlite3"
)
// Interface verification that SQLite is a valid Dialect
var (
_ Dialect = SQLite
)
func TestSQLiteQuotedTableName(t *testing.T) {
table := map[string]string{
"": "",
"MY_TABLE": `"MY_TABLE"`,
"users_roles": `"users_roles"`,
"table.with.dot": `"table.with.dot"`,
`table"with"quotes`: `"table""with""quotes"`,
`"; DROP TABLE users`: `"""DROPTABLEusers"`,
}
for ident, expected := range table {
actual := SQLite.QuotedTableName("", ident)
if expected != actual {
t.Errorf("Expected %s, got %s", expected, actual)
}
actual = SQLite.QuotedTableName(ident, "")
if expected != actual {
t.Errorf("Expected %s, got %s when table came first", expected, actual)
}
}
}