Skip to content

Commit

Permalink
[#663] bugfix: fixed first testcase, still cannot find methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzholzbauer committed Aug 23, 2024
1 parent b151079 commit 01c0866
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/module/core/core-functionality.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ describe("Core functionality", () => {
assert.isDefined(instance.programCtx);
assert.deepEqual(instance.programCtx?.errors, [], "Expected no compilation errors");
assert(
instance.write().includes("let x: Array<number> = [1, 2, 3];\nx = [4, 5, 6];"),
instance
.write()
.includes(
"let x: Array<number> = __kipper.assignTypeMeta([1, 2, 3],__kipper.builtIn.Array.changeGenericTypeArguments({T: __kipper.builtIn.num}));\nx = __kipper.assignTypeMeta([4, 5, 6],__kipper.builtIn.Array.changeGenericTypeArguments({T: __kipper.builtIn.num}));",
),
"Invalid TypeScript code (Expected different output)",
);
});
Expand All @@ -138,13 +142,17 @@ describe("Core functionality", () => {
});

it("to 'array[]'", async () => {
const fileContent = "var x: Array<num> = [1, 2, 3];\nx[0] = 4;\nprint(x[0] as str);";
const fileContent = "var x: Array<num> = [1, 2, 3];\nx[0] = 4;\nprint(x[0]);";
const instance: KipperCompileResult = await compiler.compile(fileContent, { target: defaultTarget });

assert.isDefined(instance.programCtx);
assert.deepEqual(instance.programCtx?.errors, [], "Expected no compilation errors");
assert(
instance.write().includes("let x: Array<number> = [1, 2, 3];\nx[0] = 4;"),
instance
.write()
.includes(
"let x: Array<number> = __kipper.assignTypeMeta([1, 2, 3],__kipper.builtIn.Array.changeGenericTypeArguments({T: __kipper.builtIn.num}));\nx[0] = 4;",
),
"Invalid TypeScript code (Expected different output)",
);

Expand Down

0 comments on commit 01c0866

Please sign in to comment.