(t *testing.T)
| 183 | } |
| 184 | |
| 185 | func TestSQLiteNoTruncate(t *testing.T) { |
| 186 | // Tests that running the output twice doesn't truncate the table |
| 187 | // (E.g. if I want to run Baker and insert to existing files) |
| 188 | fn, rm := testutil.TempFile(t) |
| 189 | defer rm() |
| 190 | |
| 191 | doOneRound(t, fn, false) |
| 192 | doOneRound(t, fn, false) |
| 193 | |
| 194 | conn, err := sql.Open("sqlite3", fn) |
| 195 | if err != nil { |
| 196 | t.Fatalf("Cannot open output sqlite3 after running writer. %s", err) |
| 197 | } |
| 198 | defer conn.Close() |
| 199 | |
| 200 | rows, err := conn.Query("SELECT field0, field1, field2 FROM lines") |
| 201 | if err != nil { |
| 202 | t.Fatalf("Cannot select data from sqlite3 after running writer. %s", err) |
| 203 | } |
| 204 | defer rows.Close() |
| 205 | |
| 206 | row_id := 0 |
| 207 | for rows.Next() { |
| 208 | row_id++ |
| 209 | } |
| 210 | |
| 211 | if row_id != 8 { |
| 212 | t.Fatalf("Expected 8 lines to be in sqlite3 file.") |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | func TestSQLiteTruncate(t *testing.T) { |
| 217 | // Test that, if I turn on truncating, the thing actually truncates. |
nothing calls this directly
no test coverage detected