fix ut
This commit is contained in:
parent
a64f22fd4d
commit
44b333791e
16
main_test.go
16
main_test.go
@ -1264,12 +1264,22 @@ func TestCountWithQueryOption(t *testing.T) {
|
||||
|
||||
func TestQueryHint(t *testing.T) {
|
||||
db := DB.New()
|
||||
var count int
|
||||
db.Delete(User{})
|
||||
defer db.Delete(User{})
|
||||
|
||||
err := db.Set("gorm:query_hint", "/*master*/").Raw("select ?", "1").Count(&count).Error
|
||||
DB.Create(&User{Name: "user1"})
|
||||
|
||||
var count int
|
||||
err := db.Model(User{}).Select("users.id").
|
||||
Set("gorm:query_hint", "/*master*/").
|
||||
Count(&count).Error
|
||||
|
||||
if err != nil {
|
||||
t.Error("Unexpected error on query_hint")
|
||||
t.Error("Unexpected error on query count with query_option")
|
||||
}
|
||||
|
||||
if count != 1 {
|
||||
t.Error("Unexpected result on query count with query_option")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user