Transform Throwable members to properties
This commit is contained in:
committed by
Mikhail Glukhikh
parent
9088bf67c7
commit
17c906658d
+1
-3
@@ -2,8 +2,6 @@
|
||||
|
||||
package foo
|
||||
|
||||
@native val Exception.message: String get() = noImpl
|
||||
|
||||
public fun <T : Throwable> failsWith(block: () -> Any): T {
|
||||
try {
|
||||
block()
|
||||
@@ -20,5 +18,5 @@ fun box(): String {
|
||||
throw Exception("OK")
|
||||
}
|
||||
|
||||
return a.message
|
||||
return a.message!!
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package foo
|
||||
|
||||
class Fail(val message: String) : Exception(message)
|
||||
class Fail(message: String) : Exception(message)
|
||||
|
||||
fun test(testName: String, actual: Any, expectedAsString: String) {
|
||||
val expected = eval("[$expectedAsString]")
|
||||
@@ -20,7 +20,7 @@ fun box(): String {
|
||||
test("doubleArrayOf", doubleArrayOf(0.0, 1.1, 2.2, 3.3, 4.4), "0.0, 1.1, 2.2, 3.3, 4.4")
|
||||
}
|
||||
catch (e: Fail) {
|
||||
return e.message
|
||||
return e.message!!
|
||||
}
|
||||
|
||||
return "OK"
|
||||
|
||||
Reference in New Issue
Block a user