Skip to content

Commit

Permalink
Function macro expansion bug
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewRayCode committed Jul 28, 2024
1 parent 62017d8 commit c13fb6e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/preprocessor/preprocessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,19 @@ foo`;
foo`);
});

test(`function macro where source variable is same as macro argument`, () => {
const program = `
#define GE(x, y) x + y
float z = GE(y, x);
`;

const ast = parse(program);
preprocessAst(ast);
expect(generate(ast)).toBe(`
float z = y + x;
`);
});

test("macro that isn't macro function call call is expanded", () => {
const program = `
#define foo () yes expand
Expand Down

0 comments on commit c13fb6e

Please sign in to comment.