goptrack
first commit of new line of development.
This commit is contained in:
29
pkg/tradebook/tradebook_test.go
Normal file
29
pkg/tradebook/tradebook_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package tradebook
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
func TestOpenSQLite(t *testing.T) {
|
||||
tdir := t.TempDir()
|
||||
dpath := filepath.Join(tdir, "db")
|
||||
|
||||
tb, err := Open(Sqlite(dpath))
|
||||
if (err != nil) {
|
||||
t.Errorf("Open returned error: %v", err)
|
||||
}
|
||||
|
||||
if (tb == nil) {
|
||||
t.Error("Db is nil")
|
||||
}
|
||||
|
||||
// for sqlite dsn is just a file path
|
||||
if (tb.dsn != dpath) {
|
||||
t.Errorf( "DSN does not match! (%v != %v).", dpath, tb.dsn)
|
||||
}
|
||||
|
||||
if (tb.driver != "sqlite") {
|
||||
t.Errorf("Driver is not sqlite (%v != %v).", tb.driver, "sqlite")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user