forked from mirror/go-sqlcipher
Add test
This commit is contained in:
parent
ae5cbb218c
commit
5e7aedf685
|
@ -1670,6 +1670,26 @@ func TestAuthorizer(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestNonColumnString(t *testing.T) {
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
var x interface{}
|
||||
if err := db.QueryRow("SELECT 'hello'").Scan(&x); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
s, ok := x.(string)
|
||||
if !ok {
|
||||
t.Fatal("non-column string must return string")
|
||||
}
|
||||
if s != "hello" {
|
||||
t.Fatalf("non-column string must return %q but got %q", "hello", s)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNilAndEmptyBytes(t *testing.T) {
|
||||
db, err := sql.Open("sqlite3", ":memory:")
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue