2018-04-11 05:53:09 +00:00
|
|
|
// 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.
|
|
|
|
|
2020-02-28 12:29:08 +00:00
|
|
|
package dialects
|
2018-04-11 05:53:09 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-10-27 07:32:38 +00:00
|
|
|
"xorm.io/xorm/v2/names"
|
2020-02-28 12:29:08 +00:00
|
|
|
|
2018-04-11 05:53:09 +00:00
|
|
|
"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"
|
|
|
|
}
|
|
|
|
|
2020-02-28 12:29:08 +00:00
|
|
|
func TestFullTableName(t *testing.T) {
|
|
|
|
dialect := QueryDialect("mysql")
|
2018-04-11 05:53:09 +00:00
|
|
|
|
2020-02-28 12:29:08 +00:00
|
|
|
assert.EqualValues(t, "mcc", FullTableName(dialect, names.SnakeMapper{}, &MCC{}))
|
|
|
|
assert.EqualValues(t, "mcc", FullTableName(dialect, names.SnakeMapper{}, "mcc"))
|
2018-04-11 05:53:09 +00:00
|
|
|
}
|