diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-07-27 07:22:26 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-07-27 07:22:26 +0100 |
commit | ee8bc3a307a6108db7c4195a828381caf207614e (patch) | |
tree | 3e47168be2596a2c74f560a27f4d5c50643399fc /pkg/datamaps/db_test.go | |
parent | fa310875d210cfd4a9e20b27f334de1b96dbb899 (diff) |
improved defers
Diffstat (limited to '')
-rw-r--r-- | pkg/datamaps/db_test.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pkg/datamaps/db_test.go b/pkg/datamaps/db_test.go index 2055d8a..3ca9054 100644 --- a/pkg/datamaps/db_test.go +++ b/pkg/datamaps/db_test.go @@ -1,12 +1,16 @@ package datamaps import ( + "os" "testing" ) func TestOpenSQLiteFile(t *testing.T) { db, err := setupDB("./testdata/test.db") - defer db.Close() + defer func() { + db.Close() + os.Remove("./testdata/test.db") + }() if err != nil { t.Fatal("Expected to be able to set up the database.") @@ -38,7 +42,10 @@ func TestOpenSQLiteFile(t *testing.T) { func TestDatamapGoesIntoDB(t *testing.T) { db, err := setupDB("./testdata/test.db") - defer db.Close() + defer func() { + db.Close() + os.Remove("./testdata/test.db") + }() if err != nil { t.Fatal("Expected to be able to set up the database.") |