Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: strengthen ut #332

Merged
merged 1 commit into from
Nov 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ func TestBuildSelectSQLByMultiDelete(t *testing.T) {
{
sourceQuery: []string{"delete from table_update_executor_test2 where id = ?", "delete from table_update_executor_test2 where id = ?"},
sourceQueryArgs: []driver.Value{3, 2},
expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 where id =? or id=? FOR UPDATE",
expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 WHERE id=? OR id=? FOR UPDATE",
expectQueryArgs: []driver.Value{3, 2},
},
{
sourceQuery: []string{"delete from table_update_executor_test2 where id = ?", "delete from table_update_executor_test2 where name = ? and age = ?"},
sourceQueryArgs: []driver.Value{3, "seata-go", 4},
expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 where id =? or id=? and age=? FOR UPDATE",
expectQuery: "SELECT SQL_NO_CACHE * FROM table_update_executor_test2 WHERE id=? OR name=? AND age=? FOR UPDATE",
expectQueryArgs: []driver.Value{3, "seata-go", 4},
},
}
Expand All @@ -59,6 +59,7 @@ func TestBuildSelectSQLByMultiDelete(t *testing.T) {
items, args, err := builder.buildBeforeImageSQL(tt.sourceQuery, tt.sourceQueryArgs)
assert.Nil(t, err)
assert.Equal(t, 1, len(items))
assert.Equal(t, items[0], tt.expectQuery)
assert.Equal(t, tt.expectQueryArgs, args)
})
}
Expand Down