| 161 | } |
| 162 | |
| 163 | func TestTableWithNamer(t *testing.T) { |
| 164 | db, _ := gorm.Open(tests.DummyDialector{}, &gorm.Config{ |
| 165 | NamingStrategy: schema.NamingStrategy{ |
| 166 | TablePrefix: "t_", |
| 167 | }, |
| 168 | }) |
| 169 | |
| 170 | sql := db.ToSQL(func(tx *gorm.DB) *gorm.DB { |
| 171 | return tx.Model(&UserWithTableNamer{}).Find(&UserWithTableNamer{}) |
| 172 | }) |
| 173 | |
| 174 | if !regexp.MustCompile("SELECT \\* FROM `t_users`").MatchString(sql) { |
| 175 | t.Errorf("Table with namer, got %v", sql) |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | func TestPostgresTableWithIdentifierLength(t *testing.T) { |
| 180 | if DB.Dialector.Name() != "postgres" { |