diff --git a/tests/customize_field_test.go b/tests/customize_field_test.go index 3a5a9ae..edd38b6 100644 --- a/tests/customize_field_test.go +++ b/tests/customize_field_test.go @@ -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") @@ -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") } diff --git a/tests/joins_test.go b/tests/joins_test.go index 637d76a..20447ef 100644 --- a/tests/joins_test.go +++ b/tests/joins_test.go @@ -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) } @@ -260,8 +260,8 @@ 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 @@ -269,8 +269,8 @@ func TestJoinWithSoftDeleted(t *testing.T) { 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) } } diff --git a/tests/passed-tests.txt b/tests/passed-tests.txt index 8c9af2d..a8ca13f 100644 --- a/tests/passed-tests.txt +++ b/tests/passed-tests.txt @@ -68,7 +68,7 @@ TestCreateWithAutoIncrementCompositeKey TestCreateOnConflictWithDefaultNull TestCreateFromMapWithoutPK TestCreateFromMapWithTable -#TestCustomizeColumn +TestCustomizeColumn TestCustomColumnAndIgnoredFieldClash TestCustomizeField TestDefaultValue @@ -142,7 +142,7 @@ TestJoinOn TestJoinsWithSelect TestJoinWithOmit TestJoinCount -#TestJoinWithSoftDeleted +TestJoinWithSoftDeleted TestInnerJoins TestJoinWithSameColumnName TestJoinArgsWithDB