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 abfe031
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/parser/__tests__/source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ describe('SonicWeave parser', () => {
expect(scale).toEqual([
'MOS {LLLLLLs;L=9/8;s=524288/531441}',
'9/8',

'81/64',
'729/512',
'6561/4096',
Expand Down Expand Up @@ -2061,4 +2062,28 @@ describe('SonicWeave parser', () => {
`);
expect(truth).toEqual(expand('true'));
});

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

0 comments on commit abfe031

Please sign in to comment.