JS: add tests to prove that KT-8003, KT-8318 and KT-12157 are no longer reproducible
This commit is contained in:
@@ -197,4 +197,8 @@ public final class MiscTest extends AbstractExpressionTest {
|
|||||||
public void testToGeneratorInStdlib() throws Exception {
|
public void testToGeneratorInStdlib() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testThrowThrow() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -141,4 +141,12 @@ public final class WhenTest extends AbstractExpressionTest {
|
|||||||
public void testWhenEqualsPattern() throws Exception {
|
public void testWhenEqualsPattern() throws Exception {
|
||||||
checkFooBoxIsOk();
|
checkFooBoxIsOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testWhenWithIfConditionAndOnlyElse() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testWhenConditionWithReturn() throws Exception {
|
||||||
|
checkFooBoxIsOk();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
fun test() {
|
||||||
|
throw throw Exception("catch me")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
try {
|
||||||
|
test()
|
||||||
|
error("exception not thrown")
|
||||||
|
}
|
||||||
|
catch (e: Exception) {
|
||||||
|
assertEquals("catch me", e.message)
|
||||||
|
}
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
fun test(): Int {
|
||||||
|
return when {
|
||||||
|
(return 23) is Int -> 24
|
||||||
|
else -> 25
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
assertEquals(23, test())
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package foo
|
||||||
|
|
||||||
|
var global = ""
|
||||||
|
|
||||||
|
fun <T> bar(a: T, i: Int): T {
|
||||||
|
global += "$i"
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val x = 3
|
||||||
|
when(if (x == 4) return bar("fail1", 1) else 4) {
|
||||||
|
else -> return bar("OK", 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user