Skip to content

Commit 5d51d0a

Browse files
committed
Add tests for bracket usage and introduce stat procedure
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
1 parent 6db0831 commit 5d51d0a

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-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: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3541,4 +3541,42 @@ test('issue_358_no_reference_2', async () => {
35413541
expect(parm.name.toUpperCase()).toBe(lines.substring(ref.offset.start, ref.offset.end).toUpperCase());
35423542
}
35433543
}
3544+
});
3545+
3546+
test('issue_361_bracket_usage', async () => {
3547+
const lines = [
3548+
`**FREE`,
3549+
`/copy stat`,
3550+
``,
3551+
`EXEC SQL`,
3552+
` DECLARE UserInput CURSOR FOR`,
3553+
` SELECT field FROM file`,
3554+
` WHERE field = :code`,
3555+
` ORDER BY field ASC;`,
3556+
``,
3557+
`EXEC SQL`,
3558+
` OPEN UserInput;`,
3559+
``,
3560+
`EXEC SQL`,
3561+
` FETCH NEXT FROM UserInput INTO :MyRpgVar`,
3562+
` For Read Only With NC;`,
3563+
``,
3564+
`Dow SQLSTATE = '00000';`,
3565+
` EXEC SQL`,
3566+
` FETCH NEXT FROM UserInput INTO :MyRpgVar;`,
3567+
`ENDDO;`,
3568+
``,
3569+
`EXEC SQL`,
3570+
` CLOSE UserInput;`,
3571+
].join(`\n`);
3572+
3573+
const cache = await parser.getDocs(uri, lines, { ignoreCache: true, collectReferences: true, withIncludes: true });
3574+
3575+
expect(cache.includes.length).toBe(1);
3576+
3577+
const { errors } = Linter.getErrors({ uri, content: lines }, {
3578+
RequiresParameter: true
3579+
});
3580+
3581+
expect(errors.length).toBe(0);
35443582
});

0 commit comments

Comments
 (0)