diff --git a/names/table_name_test.go b/names/table_name_test.go index 994ef80d..76da4135 100644 --- a/names/table_name_test.go +++ b/names/table_name_test.go @@ -5,6 +5,7 @@ package names import ( + "fmt" "reflect" "testing" "time" @@ -121,3 +122,19 @@ func TestGonicMapperCustomTable(t *testing.T) { assert.EqualValues(t, "oauth2_application", 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))) + } +}