diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-07-22 21:01:54 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-07-22 21:01:54 +0100 |
commit | d7d4d0a0476f98d1b0b4c5c454b6d1048a82bdad (patch) | |
tree | 11aaba3bab132e3f7d13f73c61d8b14739794f50 /pkg/reader/db_test.go | |
parent | c3d4c6bb51a3d7b89e0fcbb69230db423577ae17 (diff) |
more major surgery
Diffstat (limited to 'pkg/reader/db_test.go')
-rw-r--r-- | pkg/reader/db_test.go | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/pkg/reader/db_test.go b/pkg/reader/db_test.go deleted file mode 100644 index 5a96485..0000000 --- a/pkg/reader/db_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package reader - -import ( - "testing" -) - -func TestOpenSQLiteFile(t *testing.T) { - db, err := SetupDB("./testdata/test.db") - defer db.Close() - if err != nil { - t.Fatal("Expected to be able to set up the database.") - } - stmt := `insert into datamap(id, name) values(1,'cock')` - _, err = db.Exec(stmt) - if err != nil { - t.Errorf("Cannot add record to db") - } - rows, err := db.Query("select name from datamap") - if err != nil { - t.Errorf("Cannot run select statement") - } - defer rows.Close() - for rows.Next() { - var name string - err = rows.Scan(&name) - if err != nil { - t.Errorf("Cannot scan resulting row") - } - } -} - -func TestDatamapGoesIntoDB(t *testing.T) { - d, err := ReadDML("./testdata/datamap.csv") - if err != nil { - t.Fatal(err) - } - opts := Opts{ - DBPath: "./testdata/test.db", - Name: "First Datamap", - DMData: d, - } - err = DatamapToDB(opts) - if err != nil { - t.Errorf("Unable to write datamap to database file because %v.", err) - } -} |