mirror of https://github.com/pressly/goose.git
Fix tests
parent
a26643fb2b
commit
9012a455c2
|
@ -1,6 +1,7 @@
|
||||||
package goose
|
package goose
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -79,7 +80,7 @@ func TestSplitStatements(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
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 {
|
if len(stmts) != test.count {
|
||||||
t.Errorf("incorrect number of stmts. got %v, want %v", 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 {
|
for _, test := range tests {
|
||||||
result := useTransactions(test.fileName)
|
f, err := os.Open(test.fileName)
|
||||||
if result != test.useTransactions {
|
if err != nil {
|
||||||
t.Errorf("Failed transaction check. got %v, want %v", result, test.useTransactions)
|
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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue