From 66a2adf75f6a67a48cc8b764e44d1edfb002ff86 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 16 Sep 2023 22:05:51 +0800 Subject: [PATCH] Add test --- tests/sync_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/sync_test.go diff --git a/tests/sync_test.go b/tests/sync_test.go new file mode 100644 index 00000000..dedd3343 --- /dev/null +++ b/tests/sync_test.go @@ -0,0 +1,34 @@ +// 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))) +}