JS backend: added jsCode test cases
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package foo
|
||||
|
||||
fun factorial(n: Int): Int = js("""
|
||||
var result = 1;
|
||||
var i = 1;
|
||||
|
||||
while(i <= n) {
|
||||
result *= i++;
|
||||
}
|
||||
|
||||
return result;
|
||||
""")
|
||||
|
||||
fun box(): String {
|
||||
assertEquals(24, factorial(4))
|
||||
assertEquals(120, factorial(5))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user