THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

add test for tablename (#885)

tags/v0.6.6
Lunny Xiao GitHub 1 year ago
parent
commit
c8ae6fa95b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      engine_table_test.go

+ 28
- 0
engine_table_test.go View File

@@ -0,0 +1,28 @@
// Copyright 2018 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"
)

type MCC struct {
ID int64 `xorm:"pk 'id'"`
Code string `xorm:"'code'"`
Description string `xorm:"'description'"`
}

func (mcc *MCC) TableName() string {
return "mcc"
}

func TestTableName1(t *testing.T) {
assert.NoError(t, prepareEngine())

assert.EqualValues(t, "mcc", testEngine.TableName(new(MCC)))
assert.EqualValues(t, "mcc", testEngine.TableName("mcc"))
}

Loading…
Cancel
Save