aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/datamaps/db_test.go
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-07-27 07:22:26 +0100
committerMatthew Lemon <matt@matthewlemon.com>2020-07-27 07:22:26 +0100
commitee8bc3a307a6108db7c4195a828381caf207614e (patch)
tree3e47168be2596a2c74f560a27f4d5c50643399fc /pkg/datamaps/db_test.go
parentfa310875d210cfd4a9e20b27f334de1b96dbb899 (diff)
improved defers
Diffstat (limited to '')
-rw-r--r--pkg/datamaps/db_test.go11
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.")