Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang8330 committed Dec 19, 2024
1 parent 75bc70a commit bb510d7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/antlr/rename_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ func TestRenameTable(t *testing.T) {
assert.Equal(t, "table_b", renameTableEvent.GetTable())
assert.Equal(t, "table_a", renameTableEvent.GetNewTableName())
}
{
// Another one table variant
events, err := Parse(`RENAME TABLE current_db.tbl_name TO other_db.tbl_name;`)
assert.NoError(t, err)
assert.Len(t, events, 1)

renameTableEvent, isOk := events[0].(RenameTableEvent)
assert.True(t, isOk)

assert.Equal(t, "current_db.tbl_name", renameTableEvent.GetTable())
assert.Equal(t, "other_db.tbl_name", renameTableEvent.GetNewTableName())
}
{
// Multiple tables
events, err := Parse(`RENAME TABLE old_table TO tmp_table, new_table TO old_table, tmp_table TO new_table;`)
Expand Down

0 comments on commit bb510d7

Please sign in to comment.