Files
docker-go-dev/pkg/tradebook/tradebook_test.go
sjc 829ab54a4d goptrack
first commit of new line of development.
2021-07-06 08:35:02 -04:00

30 lines
533 B
Go

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")
}
}