add test for confirmation to fix #443
This commit is contained in:
parent
ff4299962a
commit
aa18589b49
|
@ -17,6 +17,8 @@ func isFloatEq(i, j float64, precision int) bool {
|
|||
}
|
||||
|
||||
func TestSum(t *testing.T) {
|
||||
assert.NoError(t, prepareEngine())
|
||||
|
||||
type SumStruct struct {
|
||||
Int int
|
||||
Float float32
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright 2017 The Xorm Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package xorm
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestUpdateMap(t *testing.T) {
|
||||
assert.NoError(t, prepareEngine())
|
||||
|
||||
type UpdateTable struct {
|
||||
Id int64
|
||||
Name string
|
||||
Age int
|
||||
}
|
||||
|
||||
assert.NoError(t, testEngine.Sync2(new(UpdateTable)))
|
||||
var tb = UpdateTable{
|
||||
Name: "test",
|
||||
Age: 35,
|
||||
}
|
||||
_, err := testEngine.Insert(&tb)
|
||||
assert.NoError(t, err)
|
||||
|
||||
cnt, err := testEngine.Table("update_table").Where("id = ?", tb.Id).Update(map[string]interface{}{
|
||||
"name": "test2",
|
||||
"age": 36,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 1, cnt)
|
||||
}
|
Loading…
Reference in New Issue