0
0
mirror of https://gitea.com/xorm/xorm.git synced 2025-10-06 08:52:48 +02:00
Files
xorm/tests/sync_test.go
6543 e5be0f4129 Remove dead code from session.SyncWithOptions() (#2323)
db7c264062/sync.go (L229-L231)

as oriIndex only is **not** nil if index.Equal(index2)

and index.Equal(index2) check if `oriIndex.Type == index.Type` ... so it always is false

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/2323
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
Co-committed-by: 6543 <6543@obermui.de>
2023-09-16 14:41:02 +00:00

35 lines
642 B
Go

// Copyright 2023 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 tests
import (
"testing"
"github.com/stretchr/testify/assert"
)
type TestSync1 struct {
Id int64
ClassId int64 `xorm:"index"`
}
func (TestSync1) TableName() string {
return "test_sync"
}
type TestSync2 struct {
Id int64
ClassId int64 `xorm:"unique"`
}
func (TestSync2) TableName() string {
return "test_sync"
}
func TestSync(t *testing.T) {
assert.NoError(t, testEngine.Sync(new(TestSync1)))
assert.NoError(t, testEngine.Sync(new(TestSync2)))
}