Add test for uncovered case.

This commit is contained in:
Pavel V. Talanov
2012-03-30 13:21:49 +04:00
parent fbd1279cc9
commit 36e242a9e6
3 changed files with 26 additions and 0 deletions
+4
View File
@@ -19,6 +19,10 @@ fun print(s : Any?) {}
library("parseInt")
fun parseInt(s : String) : Int = js.noImpl
library
fun safeParseInt(s : String) : Int? = js.noImpl
library
fun safeParseDouble(s : String) : Double? = js.noImpl
library
open class Exception() : Throwable() {}
library
class NumberFormatException() : Exception() {}
@@ -113,4 +113,8 @@ public final class MiscTest extends AbstractExpressionTest {
public void testTemporaryVariableCreatedInNamespaceInitializer() throws Exception {
checkFooBoxIsTrue("temporaryVariableCreatedInNamespaceInitializer.kt");
}
public void testWhenReturnedWithoutBlock() throws Exception {
checkFooBoxIsTrue("whenReturnedWithoutBlock.kt");
}
}
@@ -0,0 +1,18 @@
package foo
fun box() : Boolean {
if (t(1) != 0) {
return false
}
if (t(0) != 1) {
return false
}
return (t(100) == 2)
}
fun t(i : Int) = when(i) {
0 -> 1
1 -> 0
else -> 2
}