Skip to content

Commit

Permalink
add testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Sep 5, 2024
1 parent d56f9f1 commit dff13af
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/transpiler/src/keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class Keywords {
}

public handle(reg: abaplint.IRegistry) {
if (this.keywords.length === 0) {
return;
}
reg.parse();

for (const o of reg.getObjects()) {
Expand Down
25 changes: 24 additions & 1 deletion test/keywords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,29 @@ START-OF-SELECTION.
expect(abap.console.get()).to.equal("2");
});

// TODO: class attribute
it("class attribute", async () => {
const code = `
CLASS lcl DEFINITION.
PUBLIC SECTION.
METHODS constructor.
PRIVATE SECTION.
DATA class TYPE i.
ENDCLASS.
CLASS lcl IMPLEMENTATION.
METHOD constructor.
WRITE class.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
DATA lo TYPE REF TO lcl.
CREATE OBJECT lo.`;

const js = await run(code);
const f = new AsyncFunction("abap", js);
await f(abap);
expect(abap.console.get()).to.equal("0");
});

});

0 comments on commit dff13af

Please sign in to comment.