Skip to content

Commit 6e99355

Browse files
authored
Merge pull request #362 from codefori/worksofliam/issue361
Add tests for bracket usage and introduce stat procedure
2 parents 8d95287 + 5bdc7fd commit 6e99355

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/rpgle/stat.rpgleinc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
D stat PR 10I 0 ExtProc('stat')
2+
D filename * value
3+
D buf * value

tests/suite/linter.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3542,6 +3542,43 @@ test('issue_358_no_reference_2', async () => {
35423542
}
35433543
});
35443544

3545+
test('issue_361_bracket_usage', async () => {
3546+
const lines = [
3547+
`**FREE`,
3548+
`/copy stat`,
3549+
``,
3550+
`EXEC SQL`,
3551+
` DECLARE UserInput CURSOR FOR`,
3552+
` SELECT field FROM file`,
3553+
` WHERE field = :code`,
3554+
` ORDER BY field ASC;`,
3555+
``,
3556+
`EXEC SQL`,
3557+
` OPEN UserInput;`,
3558+
``,
3559+
`EXEC SQL`,
3560+
` FETCH NEXT FROM UserInput INTO :MyRpgVar`,
3561+
` For Read Only With NC;`,
3562+
``,
3563+
`Dow SQLSTATE = '00000';`,
3564+
` EXEC SQL`,
3565+
` FETCH NEXT FROM UserInput INTO :MyRpgVar;`,
3566+
`ENDDO;`,
3567+
``,
3568+
`EXEC SQL`,
3569+
` CLOSE UserInput;`,
3570+
].join(`\n`);
3571+
3572+
const cache = await parser.getDocs(uri, lines, { ignoreCache: true, collectReferences: true, withIncludes: true });
3573+
3574+
expect(cache.includes.length).toBe(1);
3575+
3576+
const { errors } = Linter.getErrors({ uri, content: lines }, {
3577+
RequiresParameter: true
3578+
});
3579+
3580+
expect(errors.length).toBe(0);
3581+
});
35453582

35463583
test('no names cannot be referenced', async () => {
35473584
const lines = [

0 commit comments

Comments
 (0)