Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
Several queries are now simpler as when filtering we can treat NULL and FALSE as
equivalent results (they both discard the record).
  • Loading branch information
ranma42 committed May 20, 2024
1 parent 91631eb commit 859b2cd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task FromSqlRaw_queryable_composed(bool async)
FROM (
SELECT * FROM "Customers"
) AS "m"
WHERE "m"."ContactName" IS NOT NULL AND instr("m"."ContactName", 'z') > 0
WHERE instr("m"."ContactName", 'z') > 0
""");
}

Expand Down Expand Up @@ -75,7 +75,7 @@ public override async Task FromSqlRaw_composed_with_common_table_expression(bool
)
SELECT * FROM "Customers2"
) AS "m"
WHERE "m"."ContactName" IS NOT NULL AND instr("m"."ContactName", 'z') > 0
WHERE instr("m"."ContactName", 'z') > 0
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task String_Contains_and_StartsWith_with_same_parameter(bo
SELECT "f"."Id", "f"."FirstName", "f"."LastName", "f"."NullableBool"
FROM "FunkyCustomers" AS "f"
WHERE ("f"."FirstName" IS NOT NULL AND instr("f"."FirstName", @__s_0) > 0) OR "f"."LastName" LIKE @__s_0_startswith ESCAPE '\'
WHERE instr("f"."FirstName", @__s_0) > 0 OR "f"."LastName" LIKE @__s_0_startswith ESCAPE '\'
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ SELECT COALESCE((
FROM (
SELECT DISTINCT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Lancer') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Lancer') > 0
) AS "w0"
LIMIT 1), 0)
FROM "Gears" AS "g"
Expand Down Expand Up @@ -2345,7 +2345,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool
WHERE "g"."HasSoulPatch" AND COALESCE((
SELECT DISTINCT "w"."IsAutomatic"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Lancer') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Lancer') > 0
LIMIT 1), 0)
ORDER BY "g"."Nickname"
""");
Expand Down Expand Up @@ -3052,7 +3052,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean_with_
FROM (
SELECT DISTINCT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Lancer') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Lancer') > 0
) AS "w0"
LIMIT 1)
ORDER BY "g"."Nickname"
Expand Down Expand Up @@ -3255,7 +3255,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean1(bool
FROM (
SELECT DISTINCT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Lancer') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Lancer') > 0
) AS "w0"
LIMIT 1), 0)
ORDER BY "g"."Nickname"
Expand Down Expand Up @@ -3909,7 +3909,7 @@ public override async Task Non_unicode_string_literals_is_used_for_non_unicode_c
"""
SELECT "c"."Name", "c"."Location", "c"."Nation"
FROM "Cities" AS "c"
WHERE "c"."Location" IS NOT NULL AND instr("c"."Location", 'Jacinto') > 0
WHERE instr("c"."Location", 'Jacinto') > 0
""");
}

Expand Down Expand Up @@ -4824,7 +4824,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo
SELECT COALESCE((
SELECT DISTINCT "w"."IsAutomatic"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Lancer') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Lancer') > 0
LIMIT 1), 0)
FROM "Gears" AS "g"
WHERE "g"."HasSoulPatch"
Expand Down Expand Up @@ -5050,7 +5050,7 @@ public override async Task Optional_navigation_type_compensation_works_with_bina

AssertSql(
"""
SELECT "g"."HasSoulPatch" AND "t"."Note" IS NOT NULL AND instr("t"."Note", 'Cole') > 0
SELECT "g"."HasSoulPatch" AND COALESCE(instr("t"."Note", 'Cole') > 0, 0)
FROM "Tags" AS "t"
LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId"
""");
Expand Down Expand Up @@ -7238,7 +7238,7 @@ public override async Task Optional_navigation_type_compensation_works_with_bina
SELECT "t"."Id", "t"."GearNickName", "t"."GearSquadId", "t"."IssueDate", "t"."Note"
FROM "Tags" AS "t"
LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId"
WHERE "g"."HasSoulPatch" OR ("t"."Note" IS NOT NULL AND instr("t"."Note", 'Cole') > 0)
WHERE "g"."HasSoulPatch" OR instr("t"."Note", 'Cole') > 0
""");
}

Expand Down Expand Up @@ -7334,7 +7334,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_with
FROM (
SELECT DISTINCT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Lancer') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Lancer') > 0
) AS "w0"
LIMIT 1)
FROM "Gears" AS "g"
Expand Down Expand Up @@ -8704,7 +8704,7 @@ public override async Task Include_with_complex_order_by(bool async)
ORDER BY (
SELECT "w"."Name"
FROM "Weapons" AS "w"
WHERE "g"."FullName" = "w"."OwnerFullName" AND "w"."Name" IS NOT NULL AND instr("w"."Name", 'Gnasher') > 0
WHERE "g"."FullName" = "w"."OwnerFullName" AND instr("w"."Name", 'Gnasher') > 0
LIMIT 1), "g"."Nickname", "g"."SquadId"
""");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ public override async Task String_Contains_Literal(bool async)
"""
SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region"
FROM "Customers" AS "c"
WHERE "c"."ContactName" IS NOT NULL AND instr("c"."ContactName", 'M') > 0
WHERE instr("c"."ContactName", 'M') > 0
""");
}

Expand All @@ -840,7 +840,7 @@ public override async Task String_Contains_Identity(bool async)
"""
SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region"
FROM "Customers" AS "c"
WHERE "c"."ContactName" IS NOT NULL AND instr("c"."ContactName", "c"."ContactName") > 0
WHERE instr("c"."ContactName", "c"."ContactName") > 0
""");
}

Expand All @@ -852,7 +852,7 @@ public override async Task String_Contains_Column(bool async)
"""
SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region"
FROM "Customers" AS "c"
WHERE "c"."ContactName" IS NOT NULL AND instr("c"."ContactName", "c"."ContactName") > 0
WHERE instr("c"."ContactName", "c"."ContactName") > 0
""");
}

Expand Down Expand Up @@ -886,7 +886,7 @@ public override async Task String_Contains_MethodCall(bool async)
"""
SELECT "c"."CustomerID", "c"."Address", "c"."City", "c"."CompanyName", "c"."ContactName", "c"."ContactTitle", "c"."Country", "c"."Fax", "c"."Phone", "c"."PostalCode", "c"."Region"
FROM "Customers" AS "c"
WHERE "c"."ContactName" IS NOT NULL AND instr("c"."ContactName", 'M') > 0
WHERE instr("c"."ContactName", 'M') > 0
""");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override async Task Query_expression_with_to_string_and_contains(bool asy
"""
SELECT "o"."CustomerID"
FROM "Orders" AS "o"
WHERE "o"."OrderDate" IS NOT NULL AND "o"."EmployeeID" IS NOT NULL AND instr(CAST("o"."EmployeeID" AS TEXT), '7') > 0
WHERE "o"."OrderDate" IS NOT NULL AND instr(CAST("o"."EmployeeID" AS TEXT), '7') > 0
""");
}

Expand Down

0 comments on commit 859b2cd

Please sign in to comment.