sqlite_test.go 530 B

12345678910111213141516171819202122232425262728293031
  1. package sqlite_test
  2. import (
  3. "fmt"
  4. "os"
  5. "path/filepath"
  6. "testing"
  7. "github.com/jinzhu/gorm"
  8. "github.com/jinzhu/gorm/dialects/sqlite"
  9. "github.com/jinzhu/gorm/tests"
  10. )
  11. var (
  12. DB *gorm.DB
  13. err error
  14. )
  15. func init() {
  16. if DB, err = gorm.Open(sqlite.Open(filepath.Join(os.TempDir(), "gorm.db")), &gorm.Config{}); err != nil {
  17. panic(fmt.Sprintf("failed to initialize database, got error %v", err))
  18. }
  19. }
  20. func TestCURD(t *testing.T) {
  21. tests.RunTestsSuit(t, DB)
  22. }
  23. func TestMigrate(t *testing.T) {
  24. tests.TestMigrate(t, DB)
  25. }