(t *testing.T)
| 171 | } |
| 172 | |
| 173 | func TestPlainStructExists(t *testing.T) { |
| 174 | |
| 175 | db := getLanguagesDb() |
| 176 | |
| 177 | l := &Language{Id: 1} |
| 178 | l.Recorder = New(squirrel.NewStmtCacheProxy(db), "mysql").Bind("languages", l) |
| 179 | |
| 180 | if exists, err := l.Exists(); err != nil { |
| 181 | t.Fatalf("Failed Exists: %s", err) |
| 182 | } else if exists { |
| 183 | t.Fatal("Exists should return false") |
| 184 | } |
| 185 | |
| 186 | var lastId int64 |
| 187 | if res, err := db.Exec("INSERT INTO languages (name, version, dt_release) VALUES ('Scala', '2.11.7', '2015-06-23')"); err != nil { |
| 188 | t.Fatalf("Sqlite Exec failed: %s", err) |
| 189 | } else if lastId, err = res.LastInsertId(); err != nil { |
| 190 | t.Fatalf("Sqlite LastInsertId failed: %s", err) |
| 191 | } |
| 192 | |
| 193 | l.Id = lastId |
| 194 | if exists, err := l.Exists(); err != nil { |
| 195 | t.Fatalf("Failed Exists: %s", err) |
| 196 | } else if !exists { |
| 197 | t.Fatal("Exists should return true") |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | func TestPlainStructExistsWhere(t *testing.T) { |
| 202 |
nothing calls this directly
no test coverage detected