X Tutup
Skip to content

Commit ebd6af6

Browse files
committed
test: add test
1 parent 3d8029a commit ebd6af6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

test/unit/functions/__snapshots__/noSelfAnnotation.spec.ts.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ exports[`@noSelf on parent class declaration removes context argument 1`] = `"ho
1313
exports[`@noSelf on parent interface declaration removes context argument 1`] = `"holder.myMethod()"`;
1414

1515
exports[`@noSelf on parent namespace declaration removes context argument 1`] = `"MyNamespace.myMethod()"`;
16+
17+
exports[`@noSelf on static class methods with string key access 1`] = `
18+
"TestClass.myMethod()
19+
TestClass.myKey()"
20+
`;

test/unit/functions/noSelfAnnotation.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ test("@noSelf on parent namespace declaration removes context argument", () => {
5252
`.expectLuaToMatchSnapshot();
5353
});
5454

55+
test("@noSelf on static class methods with string key access", () => {
56+
util.testModule`
57+
/** @noSelf */
58+
declare class TestClass {
59+
static [key: string]: () => void;
60+
static myMethod(): void;
61+
}
62+
63+
TestClass.myMethod();
64+
TestClass.myKey();
65+
`.expectLuaToMatchSnapshot();
66+
});
67+
5568
// additional coverage for https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1292
5669
test("explicit this parameter respected over @noSelf", () => {
5770
util.testModule`

0 commit comments

Comments
 (0)
X Tutup