Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
Fixed between test
Browse files Browse the repository at this point in the history
  • Loading branch information
YamiOdymel committed Mar 29, 2021
1 parent 70de0ec commit 14b9757
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,11 @@ func TestWhereBetween(t *testing.T) {
assertEqual(assert, "SELECT * FROM Users WHERE ID BETWEEN ? AND ?", query)
assertParams(assert, []interface{}{0, 20}, params)

query, params = Build(NewQuery("Users").WhereBetween("ID", time.Now(), time.Now().Add(time.Second*60)).Select())
now := time.Now()
nowAdd := time.Now().Add(time.Second * 60)
query, params = Build(NewQuery("Users").WhereBetween("ID", now, nowAdd).Select())
assertEqual(assert, "SELECT * FROM Users WHERE ID BETWEEN ? AND ?", query)
assertParams(assert, []interface{}{time.Now(), time.Now().Add(time.Second * 60)}, params)
assertParams(assert, []interface{}{now, nowAdd}, params)

query, params = Build(NewQuery("Users").Where("ID", "BETWEEN", 0, 20).Select())
assertEqual(assert, "SELECT * FROM Users WHERE ID BETWEEN ? AND ?", query)
Expand All @@ -667,17 +669,17 @@ func TestWhereBetween(t *testing.T) {
assertEqual(assert, "SELECT * FROM Users WHERE ID NOT BETWEEN ? AND ?", query)
assertParams(assert, []interface{}{0, 20}, params)

query, params = Build(NewQuery("Users").WhereNotBetween("ID", time.Now(), time.Now().Add(time.Second*60)).Select())
query, params = Build(NewQuery("Users").WhereNotBetween("ID", now, nowAdd).Select())
assertEqual(assert, "SELECT * FROM Users WHERE ID NOT BETWEEN ? AND ?", query)
assertParams(assert, []interface{}{time.Now(), time.Now().Add(time.Second * 60)}, params)
assertParams(assert, []interface{}{now, nowAdd}, params)

query, params = Build(NewQuery("Users").Where("ID", "NOT BETWEEN", 0, 20).Select())
assertEqual(assert, "SELECT * FROM Users WHERE ID NOT BETWEEN ? AND ?", query)
assertParams(assert, []interface{}{0, 20}, params)

query, params = Build(NewQuery("Users").Where("ID", "BETWEEN", time.Now(), time.Now().Add(time.Second*60)).Select())
query, params = Build(NewQuery("Users").Where("ID", "BETWEEN", now, nowAdd).Select())
assertEqual(assert, "SELECT * FROM Users WHERE ID BETWEEN ? AND ?", query)
assertParams(assert, []interface{}{time.Now(), time.Now().Add(time.Second * 60)}, params)
assertParams(assert, []interface{}{now, nowAdd}, params)
}

func TestWhereIn(t *testing.T) {
Expand Down

0 comments on commit 14b9757

Please sign in to comment.