MCPcopy Create free account
hub / github.com/AdRoll/baker / TestSQLiteTruncate

Function TestSQLiteTruncate

output/sqlite_test.go:216–244  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

214}
215
216func TestSQLiteTruncate(t *testing.T) {
217 // Test that, if I turn on truncating, the thing actually truncates.
218 fn, rm := testutil.TempFile(t)
219 defer rm()
220
221 doOneRound(t, fn, false)
222 doOneRoundTruncate(t, fn, true, false)
223
224 conn, err := sql.Open("sqlite3", fn)
225 if err != nil {
226 t.Fatalf("Cannot open output sqlite3 after running writer. %s", err)
227 }
228 defer conn.Close()
229
230 rows, err := conn.Query("SELECT field0, field1, field2 FROM lines")
231 if err != nil {
232 t.Fatalf("Cannot select data from sqlite3 after running writer. %s", err)
233 }
234 defer rows.Close()
235
236 row_id := 0
237 for rows.Next() {
238 row_id++
239 }
240
241 if row_id != 4 {
242 t.Fatalf("Expected 4 lines to be in sqlite3 file.")
243 }
244}
245
246func TestSQLitePrePostCommands(t *testing.T) {
247 // This test adds some pre-run and post-run SQLite commands and tests that

Callers

nothing calls this directly

Calls 4

TempFileFunction · 0.92
doOneRoundFunction · 0.85
doOneRoundTruncateFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected