@@ -288,6 +288,104 @@ export class ExpressionTests {
288288 Expect ( result ) . toBe ( expected ) ;
289289 }
290290
291+ @Test ( "Class method call" )
292+ public classMethod ( ) {
293+ const returnValue = 4 ;
294+ const source = `class TestClass {
295+ public classMethod(): number { return ${ returnValue } ; }
296+ }
297+
298+ const classInstance = new TestClass();
299+ return classInstance.classMethod();` ;
300+
301+ // Transpile
302+ const lua = util . transpileString ( source ) ;
303+
304+ // Execute
305+ const result = util . executeLua ( lua ) ;
306+
307+ // Assert
308+ Expect ( result ) . toBe ( returnValue ) ;
309+ }
310+
311+ @Test ( "Class dot method call void" )
312+ public classDotMethod ( ) {
313+ const returnValue = 4 ;
314+ const source = `class TestClass {
315+ public dotMethod: () => number = () => ${ returnValue } ;
316+ }
317+
318+ const classInstance = new TestClass();
319+ return classInstance.dotMethod();` ;
320+
321+ // Transpile
322+ const lua = util . transpileString ( source ) ;
323+
324+ // Execute
325+ const result = util . executeLua ( lua ) ;
326+
327+ // Assert
328+ Expect ( result ) . toBe ( returnValue ) ;
329+ }
330+
331+ @Test ( "Class dot method call with parameter" )
332+ public classDotMethod2 ( ) {
333+ const returnValue = 4 ;
334+ const source = `class TestClass {
335+ public dotMethod: (x: number) => number = x => 3 * x;
336+ }
337+
338+ const classInstance = new TestClass();
339+ return classInstance.dotMethod(${ returnValue } );` ;
340+
341+ // Transpile
342+ const lua = util . transpileString ( source ) ;
343+
344+ // Execute
345+ const result = util . executeLua ( lua ) ;
346+
347+ // Assert
348+ Expect ( result ) . toBe ( 3 * returnValue ) ;
349+ }
350+
351+ @Test ( "Class static dot method" )
352+ public classDotMethodStatic ( ) {
353+ const returnValue = 4 ;
354+ const source = `class TestClass {
355+ public static dotMethod: () => number = () => ${ returnValue } ;
356+ }
357+
358+ return TestClass.dotMethod();` ;
359+
360+ // Transpile
361+ const lua = util . transpileString ( source ) ;
362+
363+ // Execute
364+ const result = util . executeLua ( lua ) ;
365+
366+ // Assert
367+ Expect ( result ) . toBe ( returnValue ) ;
368+ }
369+
370+ @Test ( "Class static dot method with parameter" )
371+ public classDotMethodStaticWithParameter ( ) {
372+ const returnValue = 4 ;
373+ const source = `class TestClass {
374+ public static dotMethod: (x: number) => number = x => 3 * x;
375+ }
376+
377+ return TestClass.dotMethod(${ returnValue } );` ;
378+
379+ // Transpile
380+ const lua = util . transpileString ( source ) ;
381+
382+ // Execute
383+ const result = util . executeLua ( lua ) ;
384+
385+ // Assert
386+ Expect ( result ) . toBe ( 3 * returnValue ) ;
387+ }
388+
291389 // ====================================
292390 // Test expected errors
293391 // ====================================
0 commit comments