fix tests
This commit is contained in:
parent
1b8d08d531
commit
19b1270f7b
|
@ -143,7 +143,6 @@ func (engine *Engine) Quote(value string) string {
|
|||
|
||||
// QuoteTo quotes string and writes into the buffer
|
||||
func (engine *Engine) QuoteTo(buf *bytes.Buffer, value string) {
|
||||
|
||||
if buf == nil {
|
||||
return
|
||||
}
|
||||
|
@ -781,6 +780,12 @@ func (engine *Engine) Having(conditions string) *Session {
|
|||
return session.Having(conditions)
|
||||
}
|
||||
|
||||
func (engine *Engine) unMapType(t reflect.Type) {
|
||||
engine.mutex.Lock()
|
||||
defer engine.mutex.Unlock()
|
||||
delete(engine.Tables, t)
|
||||
}
|
||||
|
||||
func (engine *Engine) autoMapType(v reflect.Value) (*core.Table, error) {
|
||||
t := v.Type()
|
||||
engine.mutex.Lock()
|
||||
|
|
|
@ -273,10 +273,14 @@ func TestHaving(t *testing.T) {
|
|||
|
||||
func TestOrderSameMapper(t *testing.T) {
|
||||
assert.NoError(t, prepareEngine())
|
||||
testEngine.unMapType(rValue(new(Userinfo)).Type())
|
||||
|
||||
mapper := testEngine.TableMapper
|
||||
testEngine.SetTableMapper(core.SameMapper{})
|
||||
testEngine.SetMapper(core.SameMapper{})
|
||||
|
||||
defer func() {
|
||||
testEngine.SetTableMapper(mapper)
|
||||
testEngine.unMapType(rValue(new(Userinfo)).Type())
|
||||
testEngine.SetMapper(mapper)
|
||||
}()
|
||||
|
||||
assertSync(t, new(Userinfo))
|
||||
|
@ -300,10 +304,13 @@ func TestOrderSameMapper(t *testing.T) {
|
|||
|
||||
func TestHavingSameMapper(t *testing.T) {
|
||||
assert.NoError(t, prepareEngine())
|
||||
testEngine.unMapType(rValue(new(Userinfo)).Type())
|
||||
|
||||
mapper := testEngine.TableMapper
|
||||
testEngine.SetTableMapper(core.SameMapper{})
|
||||
testEngine.SetMapper(core.SameMapper{})
|
||||
defer func() {
|
||||
testEngine.SetTableMapper(mapper)
|
||||
testEngine.unMapType(rValue(new(Userinfo)).Type())
|
||||
testEngine.SetMapper(mapper)
|
||||
}()
|
||||
assertSync(t, new(Userinfo))
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
go test -db=mysql -conn_str="root:@/xorm_test"
|
|
@ -0,0 +1 @@
|
|||
go test -db=postgres -conn_str="dbname=xorm_test sslmode=disable"
|
|
@ -0,0 +1 @@
|
|||
go test -db=sqlite3 -conn_str="./test.db?cache=shared&mode=rwc"
|
Loading…
Reference in New Issue