Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/customize_field_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestCustomizeColumn(t *testing.T) {
}

var cc1 CustomizeColumn
DB.First(&cc1, "mapped_name = ?", "foo")
DB.First(&cc1, "\"mapped_name\" = ?", "foo")

if cc1.Name != expected {
t.Errorf("Failed to query CustomizeColumn")
Expand All @@ -75,7 +75,7 @@ func TestCustomizeColumn(t *testing.T) {
DB.Save(&cc)

var cc2 CustomizeColumn
DB.First(&cc2, "mapped_id = ?", 666)
DB.First(&cc2, "\"mapped_id\" = ?", 666)
if cc2.Name != "bar" {
t.Errorf("Failed to query CustomizeColumn")
}
Expand Down
10 changes: 5 additions & 5 deletions tests/joins_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func TestJoinWithSoftDeleted(t *testing.T) {

var user1 User
DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user1, user.ID)
if user1.NamedPet == nil || user1.Account.ID == 0 {
if user1.NamedPet.ID == 0 || user1.Account.ID == 0 {
t.Fatalf("joins NamedPet and Account should not empty:%v", user1)
}

Expand All @@ -260,17 +260,17 @@ func TestJoinWithSoftDeleted(t *testing.T) {

var user2 User
DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user2, user.ID)
if user2.NamedPet == nil || user2.Account.ID != 0 {
t.Fatalf("joins Account should not empty:%v", user2)
if user2.NamedPet.ID == 0 || user2.Account.ID != 0 {
t.Fatalf("joins Account should be empty:%v", user2)
}

// NamedPet should empty
DB.Delete(&user1.NamedPet)

var user3 User
DB.Model(&User{}).Joins("NamedPet").Joins("Account").First(&user3, user.ID)
if user3.NamedPet != nil || user2.Account.ID != 0 {
t.Fatalf("joins NamedPet and Account should not empty:%v", user2)
if user3.NamedPet.ID != 0 || user3.Account.ID != 0 {
t.Fatalf("joins NamedPet and Account should be empty:%v", user3)
}
}

Expand Down
4 changes: 2 additions & 2 deletions tests/passed-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ TestCreateWithAutoIncrementCompositeKey
TestCreateOnConflictWithDefaultNull
TestCreateFromMapWithoutPK
TestCreateFromMapWithTable
#TestCustomizeColumn
TestCustomizeColumn
TestCustomColumnAndIgnoredFieldClash
TestCustomizeField
TestDefaultValue
Expand Down Expand Up @@ -142,7 +142,7 @@ TestJoinOn
TestJoinsWithSelect
TestJoinWithOmit
TestJoinCount
#TestJoinWithSoftDeleted
TestJoinWithSoftDeleted
TestInnerJoins
TestJoinWithSameColumnName
TestJoinArgsWithDB
Expand Down