MCPcopy Create free account
hub / github.com/actiontech/dtle / TestRenameCreateTable

Function TestRenameCreateTable

driver/mysql/base/utils_test.go:323–360  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

321}
322
323func TestRenameCreateTable(t *testing.T) {
324 type args struct {
325 createTable string
326 newSchema string
327 newTable string
328 columnMap []string
329 }
330 tests := []struct {
331 name string
332 args args
333 want string
334 wantErr bool
335 }{
336 {
337 name: "1",
338 args: args{
339 createTable: "create table s.t (id int primary key, val int)",
340 newSchema: "s1",
341 newTable: "t1",
342 columnMap: []string{"val", "id"},
343 },
344 want: "CREATE TABLE `s1`.`t1` (`val` INT,`id` INT PRIMARY KEY)",
345 wantErr: false,
346 },
347 }
348 for _, tt := range tests {
349 t.Run(tt.name, func(t *testing.T) {
350 got, err := RenameCreateTable(tt.args.createTable, tt.args.newSchema, tt.args.newTable, tt.args.columnMap)
351 if (err != nil) != tt.wantErr {
352 t.Errorf("RenameCreateTable() error = %v, wantErr %v", err, tt.wantErr)
353 return
354 }
355 if got != tt.want {
356 t.Errorf("RenameCreateTable() got = %v, want %v", got, tt.want)
357 }
358 })
359 }
360}
361
362func TestMySQL57CollationReplaceWorkaround(t *testing.T) {
363 type args struct {

Callers

nothing calls this directly

Calls 2

RenameCreateTableFunction · 0.85
RunMethod · 0.65

Tested by

no test coverage detected