Skip to content

Commit

Permalink
Additional fixed tests
Browse files Browse the repository at this point in the history
Signed-off-by: worksofliam <[email protected]>
  • Loading branch information
worksofliam committed Dec 6, 2024
1 parent e3438b2 commit 6312389
Showing 1 changed file with 67 additions and 1 deletion.
68 changes: 67 additions & 1 deletion tests/suite/fixed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1145,4 +1145,70 @@ test('plist_test', async () => {
const cache = await parser.getDocs(uri, lines, { ignoreCache: true, withIncludes: true });

expect(cache.variables.length).to.equal(0);
});
});

test(`range test 2`, async () => {
const lines = [
` D TYPEMST_F Ds LikeDs(TYPEMST_T)`,
` D*‚ -------------------------------------------------------------------`,
` D*‚ Service Program Procedures`,
` D*‚ -------------------------------------------------------------------`,
` D $Validate_TYPEMST...`,
` D Pr n`,
` D $i_Action 4 Const`,
` D $i_Pointer * Const`,
].join(`\n`);

const cache = await parser.getDocs(uri, lines, { ignoreCache: true, withIncludes: true });

const TYPEMST_F = cache.find(`TYPEMST_F`);
expect(TYPEMST_F.range).to.deep.equal({
start: 0,
end: 0
});
});

test(`test document build up`, async () => {
const lines = [
` H*****************************************************************`,
` D*`,
` DRESSTR DS INZ`,
` D VARNAM 1 10 INZ('VAR018 ')`,
` D PF 11 11 INZ('F')`,
` D ERRMSG 12 90`,
` D EXP 12 16 INZ('EXP: ')`,
` D EXPCOD 17 21 INZ`,
` D RCV 22 27 INZ(' RCV:')`,
` D RECODE 28 32`,
` D TNAME 92 101 INZ('SQRPGNRUN ')`,
` D LIB 102 111 INZ('SQTEST ')`,
` D FILE 112 121 INZ('RPGNRSLTS ')`,
` D LIBLEN 122 125B 0 INZ(8)`,
` D FILLEN 126 129B 0 INZ(10)`,
` D*`,
` D ACTSQL S 4 0`,
` D CMPCOD S 4 0`,
` D*`,
` D DATHV S 10D DATFMT(*ISO-) INZ(D'2025-12-10')`,
` D CHKDAT S 10D DATFMT(*ISO-) INZ(D'2025-12-02')`,
` D*`,
` C/EXEC SQL`,
` C+ WHENEVER SQLERROR CONTINUE`,
` C/END-EXEC`,
` C*`,
` C*****************************************************************`,
` C*`,
` C*****************************************************************`,
` C*`,
` C MOVEL 'VAR018' VARNAM`,
` C Z-ADD -180 CMPCOD`,
` C*`,
].join(`\n`);

let document = ``;

for (let c of lines.split(``)) {
document += c;
await parser.getDocs(uri, document, { ignoreCache: true, withIncludes: true, collectReferences: true });
}
})

0 comments on commit 6312389

Please sign in to comment.