add test
This commit is contained in:
parent
127641244f
commit
7717904fa7
|
@ -5,6 +5,7 @@
|
||||||
package names
|
package names
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -121,3 +122,19 @@ func TestGonicMapperCustomTable(t *testing.T) {
|
||||||
assert.EqualValues(t, "oauth2_application",
|
assert.EqualValues(t, "oauth2_application",
|
||||||
GetTableName(LintGonicMapper, reflect.ValueOf(OAuth2Application{})))
|
GetTableName(LintGonicMapper, reflect.ValueOf(OAuth2Application{})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MyTable struct {
|
||||||
|
Idx int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *MyTable) TableName() string {
|
||||||
|
return fmt.Sprintf("mytable_%d", t.Idx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMyTable(t *testing.T) {
|
||||||
|
var table MyTable
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
table.Idx = i
|
||||||
|
assert.EqualValues(t, fmt.Sprintf("mytable_%d", i), GetTableName(SameMapper{}, reflect.ValueOf(&table)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue