(t *testing.T)
| 864 | } |
| 865 | |
| 866 | func TestScanError(t *testing.T) { |
| 867 | var schema = Schema{ |
| 868 | create: ` |
| 869 | CREATE TABLE kv ( |
| 870 | k text, |
| 871 | v integer |
| 872 | );`, |
| 873 | drop: `drop table kv;`, |
| 874 | } |
| 875 | |
| 876 | RunWithSchema(schema, t, func(db *DB, t *testing.T, now string) { |
| 877 | type WrongTypes struct { |
| 878 | K int |
| 879 | V string |
| 880 | } |
| 881 | _, err := db.Exec(db.Rebind("INSERT INTO kv (k, v) VALUES (?, ?)"), "hi", 1) |
| 882 | if err != nil { |
| 883 | t.Error(err) |
| 884 | } |
| 885 | |
| 886 | rows, err := db.Queryx("SELECT * FROM kv") |
| 887 | if err != nil { |
| 888 | t.Error(err) |
| 889 | } |
| 890 | for rows.Next() { |
| 891 | var wt WrongTypes |
| 892 | err := rows.StructScan(&wt) |
| 893 | if err == nil { |
| 894 | t.Errorf("%s: Scanning wrong types into keys should have errored.", db.DriverName()) |
| 895 | } |
| 896 | } |
| 897 | }) |
| 898 | } |
| 899 | |
| 900 | func TestMultiInsert(t *testing.T) { |
| 901 | RunWithSchema(defaultSchema, t, func(db *DB, t *testing.T, now string) { |
nothing calls this directly
no test coverage detected