Using invokeFunction() instead of invokeFunctionWithNoParams() when generating when() conditions
This commit is contained in:
@@ -9,3 +9,21 @@ fun isDigit(a: Int) : String {
|
||||
else -> "something"
|
||||
}
|
||||
}
|
||||
|
||||
fun assertDigit(i: Int, expected: String): String {
|
||||
val result = isDigit(i)
|
||||
return if (result == expected) "" else "fail: isDigit($i) = \"$result\""
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val result =
|
||||
assertDigit(239, "array list") +
|
||||
assertDigit(0, "digit") +
|
||||
assertDigit(9, "digit") +
|
||||
assertDigit(5, "digit") +
|
||||
assertDigit(19, "something") +
|
||||
assertDigit(190, "not small")
|
||||
|
||||
if (result == "") return "OK"
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user