fix-688
Yasuhiro Matsumoto 2019-02-11 00:48:49 +09:00
parent ae5cbb218c
commit 5e7aedf685
No known key found for this signature in database
GPG Key ID: 622DE34DC490584B
1 changed files with 20 additions and 0 deletions

View File

@ -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 {