Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix /undefine token and add test for indent level #311

Merged
merged 1 commit into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
});
Loading