engine_table_test.go 625 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2018 The Xorm Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package xorm
  5. import (
  6. "testing"
  7. "github.com/stretchr/testify/assert"
  8. )
  9. type MCC struct {
  10. ID int64 `xorm:"pk 'id'"`
  11. Code string `xorm:"'code'"`
  12. Description string `xorm:"'description'"`
  13. }
  14. func (mcc *MCC) TableName() string {
  15. return "mcc"
  16. }
  17. func TestTableName1(t *testing.T) {
  18. assert.NoError(t, prepareEngine())
  19. assert.EqualValues(t, "mcc", testEngine.TableName(new(MCC)))
  20. assert.EqualValues(t, "mcc", testEngine.TableName("mcc"))
  21. }