Skip to content

Commit

Permalink
Add test: captures outside variables in block expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
inthar-raven committed Jun 17, 2024
1 parent 976d4bc commit 6eeda47
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/parser/__tests__/source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2061,4 +2061,28 @@ describe('SonicWeave parser', () => {
`);
expect(truth).toEqual(expand('true'));
});

it('captures outside variables in block expressions', () => {
const pentic = expand(`{
const octave = 2;
const fifth = 3/2;
const pentic = {
(fifth ^ 2) / octave
(fifth ^ 4) / (octave ^ 2)
fifth
(fifth ^ 3) / octave
octave
};
pentic;
}`);
expect(pentic).toEqual(
expand(`{
9/8
81/64
3/2
27/16
2
}`)
);
});
});

0 comments on commit 6eeda47

Please sign in to comment.