Skip to content

Commit d21091d

Browse files
committed
added unit test
1 parent 2f4495b commit d21091d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/unit/array.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,17 @@ export class ArrayTests {
3838
const result = util.executeLua(lua);
3939
Expect(result).toBe(5);
4040
}
41+
42+
@Test("Derived array access")
43+
public derivedArrayAccess(): void {
44+
const lua = `local arr = {firstElement=function(self) return self[1]; end};`
45+
+ util.transpileString(
46+
`interface CustomArray extends Array<number>{ firstElement():number; };
47+
declare const arr: CustomArray;
48+
arr[0] = 3;
49+
return arr.firstElement();`
50+
);
51+
const result = util.executeLua(lua);
52+
Expect(result).toBe(3);
53+
}
4154
}

0 commit comments

Comments
 (0)