File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Expect , Test , TestCase } from "alsatian" ;
2+ import * as util from "../../src/util"
3+
4+ export class LuaCurryTests {
5+
6+ @Test ( "currying" )
7+ public currying ( ) {
8+ // Transpile
9+ let lua = util . transpileString (
10+ `(x: number) => (y: number) => x + y;`
11+ , util . dummyTypes . Number
12+ ) ;
13+ // Assert
14+ Expect ( lua ) . toBe ( `function(x) return function(y) return x+y end end` ) ;
15+ }
16+
17+ @Test ( "curryingAdd" )
18+ @TestCase ( 2 , 3 )
19+ @TestCase ( 5 , 4 )
20+ public curryingAdd ( x : number , y : number ) {
21+ // Transpile
22+ let lua = util . transpileString (
23+ `let add = (x: number) => (y: number) => x + y;
24+ return add(${ x } )(${ y } )`
25+ , util . dummyTypes . Number
26+ ) ;
27+
28+ // Execute
29+ let result = util . executeLua ( lua ) ;
30+
31+ // Assert
32+ Expect ( result ) . toBe ( x + y ) ;
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments