add test for confirmation to fix #443

This commit is contained in:
Lunny Xiao 2017-03-26 21:11:56 +08:00
parent ff4299962a
commit aa18589b49
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
2 changed files with 38 additions and 0 deletions

View File

@ -17,6 +17,8 @@ func isFloatEq(i, j float64, precision int) bool {
} }
func TestSum(t *testing.T) { func TestSum(t *testing.T) {
assert.NoError(t, prepareEngine())
type SumStruct struct { type SumStruct struct {
Int int Int int
Float float32 Float float32

36
session_update_test.go Normal file
View File

@ -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)
}