Skip to content

Commit

Permalink
Add a test for #6767 (#6771)
Browse files Browse the repository at this point in the history
It passes on master already, though fails on 3.x and 4.x.
  • Loading branch information
msullivan authored Feb 1, 2024
1 parent fed3793 commit 2a43256
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/test_edgeql_coalesce.py
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,60 @@ async def test_edgeql_coalesce_overload_02(self):
]),
)

async def test_edgeql_coalesce_single_links_01(self):
await self.con.execute(
'''
CREATE TYPE default::Content;
CREATE TYPE default::Noob {
CREATE LINK primary: default::Content;
CREATE LINK secondary: default::Content;
};
insert Noob {
primary := (insert Content)
};
insert Noob {
secondary := (insert Content)
};
'''
)

await self.assert_query_result(
r'''
select Noob {
coalesce := (.primary ?? .secondary),
};
''',
[
{'coalesce': {'id': str}},
{'coalesce': {'id': str}},
],
implicit_limit=100,
)

await self.assert_query_result(
r'''
select Noob {
coalesce := (select (.primary ?? .secondary) limit 100),
};
''',
[
{'coalesce': {'id': str}},
{'coalesce': {'id': str}},
],
)

await self.assert_query_result(
r'''
select Noob {
coalesce := {.primary ?? .secondary},
};
''',
[
{'coalesce': {'id': str}},
{'coalesce': {'id': str}},
],
)

async def test_edgeql_optional_leakage_01(self):
await self.con.execute(
r'''
Expand Down

0 comments on commit 2a43256

Please sign in to comment.