Skip to content

Commit

Permalink
Fix some MS SQL syntaxes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kiendang committed Sep 7, 2024
1 parent 13c8830 commit e9ca43f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions scalasql/test/src/operations/DbBlobOpsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait ExprBlobOpsTests extends ScalaSqlSuite {

test("length") - checker(
query = Expr(Bytes("hello")).length,
sql = "SELECT LENGTH(?) AS res",
sqls = Seq("SELECT LENGTH(?) AS res", "SELECT LEN(?) AS res"),
value = 5
)

Expand All @@ -39,7 +39,11 @@ trait ExprBlobOpsTests extends ScalaSqlSuite {

test("position") - checker(
query = Expr(Bytes("hello")).indexOf(Bytes("ll")),
sqls = Seq("SELECT POSITION(? IN ?) AS res", "SELECT INSTR(?, ?) AS res"),
sqls = Seq(
"SELECT POSITION(? IN ?) AS res",
"SELECT INSTR(?, ?) AS res",
"SELECT CHARINDEX(?, ?) AS res"
),
value = 3
)
// Not supported by postgres
Expand Down
8 changes: 6 additions & 2 deletions scalasql/test/src/operations/DbStringOpsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ trait ExprStringOpsTests extends ScalaSqlSuite {

test("length") - checker(
query = Expr("hello").length,
sql = "SELECT LENGTH(?) AS res",
sqls = Seq("SELECT LENGTH(?) AS res", "SELECT LEN(?) AS res"),
value = 5
)

Expand All @@ -39,7 +39,11 @@ trait ExprStringOpsTests extends ScalaSqlSuite {

test("position") - checker(
query = Expr("hello").indexOf("ll"),
sqls = Seq("SELECT POSITION(? IN ?) AS res", "SELECT INSTR(?, ?) AS res"),
sqls = Seq(
"SELECT POSITION(? IN ?) AS res",
"SELECT INSTR(?, ?) AS res",
"SELECT CHARINDEX(?, ?) AS res"
),
value = 3
)

Expand Down

0 comments on commit e9ca43f

Please sign in to comment.