Skip to content

Commit

Permalink
add test for tablename (go-xorm#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Apr 11, 2018
1 parent 3ef987a commit c8ae6fa
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions engine_table_test.go
Original file line number Diff line number Diff line change
@@ -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"))
}

0 comments on commit c8ae6fa

Please sign in to comment.