From 8eed0e209ad7df42a77922f5f72149ec0795a702 Mon Sep 17 00:00:00 2001 From: go-jet Date: Thu, 20 Jan 2022 16:54:18 +0100 Subject: [PATCH] Fix ident --- tests/mysql/delete_test.go | 12 ++++++------ tests/postgres/delete_test.go | 18 ++++++++++-------- tests/postgres/update_test.go | 27 +++++++++++++++------------ tests/sqlite/update_test.go | 23 +++++++++++++---------- 4 files changed, 44 insertions(+), 36 deletions(-) diff --git a/tests/mysql/delete_test.go b/tests/mysql/delete_test.go index a2a8e0b..be2c144 100644 --- a/tests/mysql/delete_test.go +++ b/tests/mysql/delete_test.go @@ -102,10 +102,11 @@ func TestDeleteWithUsing(t *testing.T) { table.Rental. INNER_JOIN(table.Staff, table.Rental.StaffID.EQ(table.Staff.StaffID)), table.Actor, - ).WHERE( - table.Staff.StaffID.EQ(Int(2)). - AND(table.Rental.RentalID.LT(Int(10))), - ) + ). + WHERE( + table.Staff.StaffID.EQ(Int(2)). + AND(table.Rental.RentalID.LT(Int(10))), + ) testutils.AssertStatementSql(t, stmt, ` DELETE FROM dvds.rental @@ -115,6 +116,5 @@ USING dvds.rental WHERE (staff.staff_id = ?) AND (rental.rental_id < ?); `) - _, err := stmt.Exec(tx) - require.NoError(t, err) + testutils.AssertExec(t, stmt, db, 3) } diff --git a/tests/postgres/delete_test.go b/tests/postgres/delete_test.go index 9ae9ec9..47637e1 100644 --- a/tests/postgres/delete_test.go +++ b/tests/postgres/delete_test.go @@ -122,14 +122,16 @@ func TestDeleteFrom(t *testing.T) { table.Staff. INNER_JOIN(table.Store, table.Store.StoreID.EQ(table.Staff.StaffID)), table.Actor, - ).WHERE( - table.Staff.StaffID.EQ(table.Rental.StaffID). - AND(table.Staff.StaffID.EQ(Int(2))). - AND(table.Rental.RentalID.LT(Int(10))), - ).RETURNING( - table.Rental.AllColumns, - table.Store.AllColumns, - ) + ). + WHERE( + table.Staff.StaffID.EQ(table.Rental.StaffID). + AND(table.Staff.StaffID.EQ(Int(2))). + AND(table.Rental.RentalID.LT(Int(10))), + ). + RETURNING( + table.Rental.AllColumns, + table.Store.AllColumns, + ) testutils.AssertStatementSql(t, stmt, ` DELETE FROM dvds.rental diff --git a/tests/postgres/update_test.go b/tests/postgres/update_test.go index cf8a3b8..6cde276 100644 --- a/tests/postgres/update_test.go +++ b/tests/postgres/update_test.go @@ -382,18 +382,21 @@ func TestUpdateFrom(t *testing.T) { stmt := table.Rental.UPDATE(). SET( table.Rental.RentalDate.SET(Timestamp(2020, 2, 2, 0, 0, 0)), - ).FROM( - table.Staff. - INNER_JOIN(table.Store, table.Store.StoreID.EQ(table.Staff.StaffID)), - table.Actor, - ).WHERE( - table.Staff.StaffID.EQ(table.Rental.StaffID). - AND(table.Staff.StaffID.EQ(Int(2))). - AND(table.Rental.RentalID.LT(Int(10))), - ).RETURNING( - table.Rental.AllColumns.Except(table.Rental.LastUpdate), - table.Store.AllColumns.Except(table.Store.LastUpdate), - ) + ). + FROM( + table.Staff. + INNER_JOIN(table.Store, table.Store.StoreID.EQ(table.Staff.StaffID)), + table.Actor, + ). + WHERE( + table.Staff.StaffID.EQ(table.Rental.StaffID). + AND(table.Staff.StaffID.EQ(Int(2))). + AND(table.Rental.RentalID.LT(Int(10))), + ). + RETURNING( + table.Rental.AllColumns.Except(table.Rental.LastUpdate), + table.Store.AllColumns.Except(table.Store.LastUpdate), + ) testutils.AssertStatementSql(t, stmt, ` UPDATE dvds.rental diff --git a/tests/sqlite/update_test.go b/tests/sqlite/update_test.go index 99560ec..110c659 100644 --- a/tests/sqlite/update_test.go +++ b/tests/sqlite/update_test.go @@ -298,16 +298,19 @@ func TestUpdateFrom(t *testing.T) { stmt := table.Rental.UPDATE(). SET( table.Rental.RentalDate.SET(DateTime(2020, 2, 2, 0, 0, 0)), - ).FROM( - table.Staff. - INNER_JOIN(table.Store, table.Store.StoreID.EQ(table.Staff.StaffID)), - ).WHERE( - table.Staff.StaffID.EQ(table.Rental.StaffID). - AND(table.Staff.StaffID.EQ(Int(2))). - AND(table.Rental.RentalID.LT(Int(10))), - ).RETURNING( - table.Rental.AllColumns.Except(table.Rental.LastUpdate), - ) + ). + FROM( + table.Staff. + INNER_JOIN(table.Store, table.Store.StoreID.EQ(table.Staff.StaffID)), + ). + WHERE( + table.Staff.StaffID.EQ(table.Rental.StaffID). + AND(table.Staff.StaffID.EQ(Int(2))). + AND(table.Rental.RentalID.LT(Int(10))), + ). + RETURNING( + table.Rental.AllColumns.Except(table.Rental.LastUpdate), + ) testutils.AssertDebugStatementSql(t, stmt, ` UPDATE rental