Skip to content

Commit

Permalink
Update test to trigger panic
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSchinnerl committed Sep 6, 2023
1 parent e5208c4 commit ffc1c17
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import (
// GORM_BRANCH: master
// TEST_DRIVERS: sqlite, mysql, postgres, sqlserver

func TestGORM(t *testing.T) {
user := User{Name: "jinzhu"}
type Bar struct {
ID uint `gorm:"primarykey"`
}

DB.Create(&user)
type Foo struct {
ID uint `gorm:"primarykey"`
BarID uint `gorm:"index;NOT NULL"`
Bar Bar
}

var result User
if err := DB.First(&result, user.ID).Error; err != nil {
t.Errorf("Failed, got error: %v", err)
}
func TestGORM(t *testing.T) {
DB.Table("foo").AutoMigrate(&Foo{})
}

0 comments on commit ffc1c17

Please sign in to comment.