mirror of https://github.com/go-gorm/gorm.git
fix test
This commit is contained in:
parent
e9c3b25552
commit
294255c11b
|
@ -241,7 +241,9 @@ func TestEmbeddedRelations(t *testing.T) {
|
|||
Advanced bool
|
||||
}
|
||||
|
||||
DB.Migrator().DropTable(&AdvancedUser{})
|
||||
if err := DB.Migrator().DropTable(&AdvancedUser{}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if err := DB.AutoMigrate(&AdvancedUser{}); err != nil {
|
||||
if DB.Dialector.Name() != "sqlite" {
|
||||
|
|
|
@ -62,7 +62,7 @@ func TestUpsert(t *testing.T) {
|
|||
}
|
||||
|
||||
r := DB.Session(&gorm.Session{DryRun: true}).Clauses(clause.OnConflict{UpdateAll: true}).Create(&RestrictedLanguage{Code: "upsert_code", Name: "upsert_name", Lang: "upsert_lang"})
|
||||
if !regexp.MustCompile(`INTO .restricted_languages. .*\(.code.,.name.,.lang.\) .* (SET|UPDATE) .name. = .*.name.\W*$`).MatchString(r.Statement.SQL.String()) {
|
||||
if !regexp.MustCompile(`INTO .restricted_languages. .*\(.code.,.name.,.lang.\) .* (SET|UPDATE) .name.*=.*.name.\W*$`).MatchString(r.Statement.SQL.String()) {
|
||||
t.Errorf("Table with escape character, got %v", r.Statement.SQL.String())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue