Skip to content

Commit

Permalink
fix /undefine token and add test for indent level
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonp42 committed Apr 16, 2024
1 parent 29018ae commit 3549185
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion language/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const commonMatchers: Matcher[] = [
{ type: `divide` },
{
type: `word`,
match: (word) => [`TITLE`, `EJECT`, `SPACE`, `COPY`, `INCLUDE`, `SET`, `RESTORE`, `OVERLOAD`, `DEFINE`, `UNDEFINED`, `IF`, `ELSE`, `ELSEIF`, `ENDIF`, `EOF`, `CHARCOUNT`].includes(word.toUpperCase())
match: (word) => [`TITLE`, `EJECT`, `SPACE`, `COPY`, `INCLUDE`, `SET`, `RESTORE`, `OVERLOAD`, `DEFINE`, `UNDEFINE`, `IF`, `ELSE`, `ELSEIF`, `ENDIF`, `EOF`, `CHARCOUNT`].includes(word.toUpperCase())
},
],
becomes: {
Expand Down
23 changes: 22 additions & 1 deletion tests/suite/linter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3281,4 +3281,25 @@ test(`snd-msg casing #309`, async () => {
}, cache);

expect(errors.length).toBe(0);
});
});

test(`define and undefine directives #310`, async () => {
const lines = [
`**free`,
`/define #stuff`,
`// do exciting things here`,
`/undefine #stuff`,
`dcl-ds gPSDS psds qualified;`,
` pgmName *proc;`,
`end-ds;`,
`*inlr = *on;`,
`return;`,
].join(`\n`);

const cache = await parser.getDocs(uri, lines, { ignoreCache: true, withIncludes: true });
const { indentErrors } = Linter.getErrors({ uri, content: lines }, {
indent: 2
}, cache);

expect(indentErrors.length).toBe(0);
});

0 comments on commit 3549185

Please sign in to comment.