gorm/dialects/sqlite/sqlite_test.go

32 lines
531 B
Go
Raw Normal View History

2020-02-02 03:35:01 +03:00
package sqlite_test
import (
2020-02-02 09:40:44 +03:00
"fmt"
2020-02-02 03:35:01 +03:00
"os"
"path/filepath"
"testing"
"github.com/jinzhu/gorm"
2020-02-02 09:40:44 +03:00
"github.com/jinzhu/gorm/dialects/sqlite"
"github.com/jinzhu/gorm/tests"
2020-02-02 03:35:01 +03:00
)
2020-02-02 09:40:44 +03:00
var (
2020-03-09 10:32:55 +03:00
DB gorm.DB
2020-02-02 09:40:44 +03:00
err error
)
func init() {
if DB, err = gorm.Open(sqlite.Open(filepath.Join(os.TempDir(), "gorm.db")), &gorm.Config{}); err != nil {
panic(fmt.Sprintf("failed to initialize database, got error %v", err))
}
}
2020-02-02 03:35:01 +03:00
2020-02-22 14:41:01 +03:00
func TestCURD(t *testing.T) {
2020-03-09 10:32:55 +03:00
tests.RunTestsSuit(t, &DB)
2020-02-02 03:35:01 +03:00
}
2020-02-22 14:41:01 +03:00
func TestMigrate(t *testing.T) {
2020-03-09 10:32:55 +03:00
tests.TestMigrate(t, &DB)
2020-02-22 14:41:01 +03:00
}