aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/datamaps/reader_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/reader_test.go
parentfa310875d210cfd4a9e20b27f334de1b96dbb899 (diff)
improved defers
Diffstat (limited to 'pkg/datamaps/reader_test.go')
-rw-r--r--pkg/datamaps/reader_test.go16
1 files changed, 13 insertions, 3 deletions
diff --git a/pkg/datamaps/reader_test.go b/pkg/datamaps/reader_test.go
index c221b26..53aff4a 100644
--- a/pkg/datamaps/reader_test.go
+++ b/pkg/datamaps/reader_test.go
@@ -1,6 +1,7 @@
package datamaps
import (
+ "os"
"testing"
)
@@ -73,7 +74,10 @@ func TestReadXLSX(t *testing.T) {
// func TestExtractWithDBDatamap(t *testing.T) {
// // setup - we need the datamap in the test database
// 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.")
@@ -95,7 +99,10 @@ func TestReadXLSX(t *testing.T) {
func TestDMLSliceFromDatabase(t *testing.T) {
// setup - we need the datamap in the test database
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.")
@@ -142,7 +149,10 @@ func TestDMLSliceFromDatabase(t *testing.T) {
func TestExtractUsingDBDM(t *testing.T) {
// setup - we need the datamap in the test database
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.")