Skip to content

Commit

Permalink
Add a test for sequence expressions in match argument and body
Browse files Browse the repository at this point in the history
Summary:
Add a test for sequence expressions in match argument and body, making sure that the sequence expressions are always wrapped in parens when printed.

Original Author: [email protected]
Original Git: 667676a
Original Reviewed By: SamChou19815
Original Revision: D67489432

Reviewed By: fbmal7

Differential Revision: D67867898

fbshipit-source-id: bf4fecaa7dc3d95f6b257b38700adcb6facec11d
  • Loading branch information
dannysu authored and facebook-github-bot committed Jan 7, 2025
1 parent 1e3dd83 commit 3a51649
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ describe('Match expression', () => {
`);
});

test('sequence expressions: always with parens', async () => {
expect(
format(`
const e = match (x, y) {
1: (x, y),
2 if (x, y): 0,
};
`),
).toMatchInlineSnapshot(`
"const e = match ((x, y)) {
1: (x, y),
2 if (x, y): 0,
};
"
`);
});

test('patterns: core', async () => {
expect(
format(`
Expand Down

0 comments on commit 3a51649

Please sign in to comment.