Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
greg-rychlewski committed Feb 24, 2024
1 parent 5153a16 commit e1ef5cb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/ecto/query/planner_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,14 @@ defmodule Ecto.Query.PlannerTest do

assert Macro.to_string(hd(hd(query.joins).source.query.wheres).expr) == "parent_as(:posts).visits() == ^0"
assert cast_params == [123]

child = from(c in Comment, where: field(parent_as(^as), "visits") == ^"123")

{query, cast_params, _, _} =
from(Post, as: :posts, join: c in subquery(child), on: true) |> normalize_with_params()

assert Macro.to_string(hd(hd(query.joins).source.query.wheres).expr) == "parent_as(:posts).visits() == ^0"
assert cast_params == [123]
end

test "normalize: nested parent_as" do
Expand Down

0 comments on commit e1ef5cb

Please sign in to comment.