Skip to content

Commit

Permalink
test: strengthen ut (#332)
Browse files Browse the repository at this point in the history
  • Loading branch information
baerwang authored Nov 5, 2022
1 parent 953e7e2 commit 7f7a079
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 7f7a079

Please sign in to comment.