From 9012a455c2f19909ac0a96eabd47f8ea2876138a Mon Sep 17 00:00:00 2001 From: Vojtech Vitek Date: Tue, 20 Jun 2017 16:38:00 -0400 Subject: [PATCH] Fix tests --- migration_sql_test.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/migration_sql_test.go b/migration_sql_test.go index 06f5aa8..e72662a 100644 --- a/migration_sql_test.go +++ b/migration_sql_test.go @@ -1,6 +1,7 @@ package goose import ( + "os" "strings" "testing" ) @@ -79,7 +80,7 @@ func TestSplitStatements(t *testing.T) { } for _, test := range tests { - stmts := splitSQLStatements(strings.NewReader(test.sql), test.direction) + stmts, _ := getSQLStatements(strings.NewReader(test.sql), test.direction) if len(stmts) != test.count { t.Errorf("incorrect number of stmts. got %v, want %v", len(stmts), test.count) } @@ -108,10 +109,15 @@ func TestUseTransactions(t *testing.T) { } for _, test := range tests { - result := useTransactions(test.fileName) - if result != test.useTransactions { - t.Errorf("Failed transaction check. got %v, want %v", result, test.useTransactions) + f, err := os.Open(test.fileName) + if err != nil { + t.Error(err) } + _, useTx := getSQLStatements(f, true) + if useTx != test.useTransactions { + t.Errorf("Failed transaction check. got %v, want %v", useTx, test.useTransactions) + } + f.Close() } }