Add tests for get var (#1305)

* add test for SQL get
* fix tests
This commit is contained in:
Lunny Xiao 2019-07-30 00:02:45 +08:00 committed by BetaCat
parent a691000f06
commit 73a7003f43
1 changed files with 6 additions and 0 deletions

View File

@ -47,6 +47,12 @@ func TestGetVar(t *testing.T) {
assert.Equal(t, true, has)
assert.Equal(t, 28, age)
var ageMax int
has, err = testEngine.SQL("SELECT max(age) FROM "+testEngine.TableName("get_var", true)+" WHERE `id` = ?", data.Id).Get(&ageMax)
assert.NoError(t, err)
assert.Equal(t, true, has)
assert.Equal(t, 28, ageMax)
var age2 int64
has, err = testEngine.Table("get_var").Cols("age").
Where("age > ?", 20).