Fix test to actually fail if expected exception is not thrown.
This commit is contained in:
committed by
Alexander Udalov
parent
1a59e41224
commit
4b77db8979
@@ -2,15 +2,14 @@
|
|||||||
|
|
||||||
fun f(
|
fun f(
|
||||||
f1: () -> String = { f2() },
|
f1: () -> String = { f2() },
|
||||||
f2: () -> String = { "FAIL" }
|
f2: () -> String = { "Fail: should not be called" }
|
||||||
): String = f1()
|
): String = f1()
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
var result = "fail"
|
|
||||||
try {
|
try {
|
||||||
f()
|
f()
|
||||||
|
return "Fail: f() should have thrown NPE"
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
result = "OK"
|
|
||||||
}
|
}
|
||||||
return f(f2 = { "O" }) + f(f1 = { "K" })
|
return f(f2 = { "O" }) + f(f1 = { "K" })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user