Test data: do not use exceptions from java.lang, as they are not available in JS

This commit is contained in:
Ilya Gorbunov
2016-07-15 21:44:47 +03:00
parent d943079557
commit 0ebfba7a1a
19 changed files with 60 additions and 60 deletions
@@ -43,7 +43,7 @@ fun test0(h: Holder, throwException: Boolean): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (throwException) { if (throwException) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -47,7 +47,7 @@ fun test0(h: Holder, throwException: Boolean): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (throwException) { if (throwException) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -55,7 +55,7 @@ fun test0(h: Holder, throwException: Boolean): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (throwException) { if (throwException) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -55,7 +55,7 @@ fun test0(h: Holder, throwException: Boolean): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (throwException) { if (throwException) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -59,7 +59,7 @@ fun test0(h: Holder, throwException: Boolean): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (throwException) { if (throwException) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -37,7 +37,7 @@ fun test0(h: Holder): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -94,7 +94,7 @@ fun test3(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return "OK_NONLOCAL" return "OK_NONLOCAL"
}, },
@@ -115,7 +115,7 @@ fun test4(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -51,7 +51,7 @@ fun test0(h: Holder): Int {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1 return 1
}, },
@@ -108,7 +108,7 @@ fun test3(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return "OK_NONLOCAL" return "OK_NONLOCAL"
}, },
@@ -129,7 +129,7 @@ fun test4(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -37,7 +37,7 @@ fun test0(h: Holder): Long {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return 1.toLong() return 1.toLong()
}, },
@@ -94,7 +94,7 @@ fun test3(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return "OK_NONLOCAL" return "OK_NONLOCAL"
}, },
@@ -115,7 +115,7 @@ fun test4(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -2,9 +2,9 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String { public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String {
try { try {
@@ -27,7 +27,7 @@ public inline fun <R> doCall2(block: ()-> R, exception: (e: Exception)-> Unit, f
} finally { } finally {
finallyBlock() finallyBlock()
} }
throw java.lang.RuntimeException("fail") throw RuntimeException("fail")
} }
// FILE: 2.kt // FILE: 2.kt
@@ -56,7 +56,7 @@ fun test0(h: Holder): String {
{ {
try { try {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
} finally { } finally {
h.value += ", OK_FINALLY_INNER" h.value += ", OK_FINALLY_INNER"
@@ -95,7 +95,7 @@ fun test01(h: Holder): String {
{ {
try { try {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
} catch(e: RuntimeException) { } catch(e: RuntimeException) {
h.value += ", OK_CATCHED" h.value += ", OK_CATCHED"
} finally { } finally {
@@ -125,7 +125,7 @@ fun test02(h: Holder): String {
{ {
try { try {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
} catch(e: RuntimeException) { } catch(e: RuntimeException) {
h.value += ", OK_CATCHED" h.value += ", OK_CATCHED"
} finally { } finally {
@@ -2,9 +2,9 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String,
exception3: (e: Exception)-> Unit, exception4: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String { exception3: (e: Exception)-> Unit, exception4: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String {
@@ -2,7 +2,7 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String { public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String {
try { try {
@@ -37,7 +37,7 @@ fun test01(h: Holder): String {
{ {
try { try {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
} catch(e: RuntimeException) { } catch(e: RuntimeException) {
h.value += ", OK_CATCHED" h.value += ", OK_CATCHED"
} }
@@ -2,9 +2,9 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String,
exception3: (e: Exception)-> Unit, exception4: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String { exception3: (e: Exception)-> Unit, exception4: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String {
@@ -2,9 +2,9 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, finallyBlock: ()-> String, public inline fun doCall(block: ()-> String, exception1: (e: Exception)-> Unit, finallyBlock: ()-> String,
exception3: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String { exception3: (e: Exception)-> Unit, finallyBlock2: ()-> String, res: String = "Fail") : String {
@@ -2,9 +2,9 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, finallyBlock: ()-> String, public inline fun doCall(block: ()-> String, finallyBlock: ()-> String,
finallyBlock2: ()-> String, res: String = "Fail") : String { finallyBlock2: ()-> String, res: String = "Fail") : String {
@@ -38,7 +38,7 @@ fun test3(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return "OK_NONLOCAL" return "OK_NONLOCAL"
}, },
@@ -55,7 +55,7 @@ fun test4(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -74,7 +74,7 @@ fun test5(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -82,7 +82,7 @@ fun test5(h: Holder): String {
{ {
h.value += ", OK_EXCEPTION" h.value += ", OK_EXCEPTION"
if (true) { if (true) {
throw java.lang.RuntimeException("EXCEPTION") throw RuntimeException("EXCEPTION")
} }
h.value += "fail" h.value += "fail"
@@ -2,9 +2,9 @@
package test package test
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String { public inline fun doCall(block: ()-> String, exception: (e: Exception)-> Unit, exception2: (e: Exception)-> Unit, finallyBlock: ()-> String, res: String = "Fail") : String {
try { try {
@@ -27,7 +27,7 @@ public inline fun <R> doCall2(block: ()-> R, exception: (e: Exception)-> Unit, f
} finally { } finally {
finallyBlock() finallyBlock()
} }
throw java.lang.RuntimeException("fail") throw RuntimeException("fail")
} }
// FILE: 2.kt // FILE: 2.kt
@@ -55,7 +55,7 @@ fun test0(h: Holder): String {
}, },
{ {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
}) })
@@ -137,7 +137,7 @@ fun test1(h: Holder): String {
}, },
{ {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
}, "Fail") }, "Fail")
} }
@@ -201,7 +201,7 @@ fun test3(h: Holder): String {
}, },
{ {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
}, "Fail") }, "Fail")
} }
@@ -257,7 +257,7 @@ fun test5(h: Holder): String {
}, },
{ {
h.value += ", OK_EXCEPTION" h.value += ", OK_EXCEPTION"
throw java.lang.RuntimeException("FAIL_EX") throw RuntimeException("FAIL_EX")
"OK_EXCEPTION" "OK_EXCEPTION"
}, },
{ {
@@ -43,7 +43,7 @@ fun test1(h: Holder): String {
val localResult = doCall ( val localResult = doCall (
{ {
h.value += "OK_LOCAL" h.value += "OK_LOCAL"
throw java.lang.RuntimeException() throw RuntimeException()
"OK_LOCAL" "OK_LOCAL"
}, },
{ {
@@ -81,7 +81,7 @@ fun test3(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
return "OK_NONLOCAL" return "OK_NONLOCAL"
}, },
@@ -102,7 +102,7 @@ fun test4(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -124,7 +124,7 @@ fun test5(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -132,7 +132,7 @@ fun test5(h: Holder): String {
{ {
h.value += ", OK_EXCEPTION" h.value += ", OK_EXCEPTION"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
@@ -153,7 +153,7 @@ fun test6(h: Holder): String {
{ {
h.value += "OK_NONLOCAL" h.value += "OK_NONLOCAL"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
return "OK_NONLOCAL" return "OK_NONLOCAL"
@@ -161,7 +161,7 @@ fun test6(h: Holder): String {
{ {
h.value += ", OK_EXCEPTION" h.value += ", OK_EXCEPTION"
if (true) { if (true) {
throw java.lang.RuntimeException() throw RuntimeException()
} }
h.value += "fail" h.value += "fail"
@@ -20,7 +20,7 @@ public inline fun <R> doCall2(block: ()-> R, exception: (e: Exception)-> Unit, f
} finally { } finally {
finallyBlock() finallyBlock()
} }
throw java.lang.RuntimeException("fail") throw RuntimeException("fail")
} }
// FILE: 2.kt // FILE: 2.kt
@@ -44,7 +44,7 @@ fun test0(h: Holder): String {
}, },
{ {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
}) })
@@ -65,7 +65,7 @@ fun test1(h: Holder): String {
val localResult = doCall ( val localResult = doCall (
{ {
h.value += "OK_LOCAL" h.value += "OK_LOCAL"
throw java.lang.RuntimeException("FAIL") throw RuntimeException("FAIL")
"OK_LOCAL" "OK_LOCAL"
}, },
{ {
@@ -74,7 +74,7 @@ fun test1(h: Holder): String {
}, },
{ {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
}) })
} catch (e: RuntimeException) { } catch (e: RuntimeException) {
@@ -93,7 +93,7 @@ fun test2(h: Holder): String {
val localResult = doCall ( val localResult = doCall (
{ {
h.value += "OK_LOCAL" h.value += "OK_LOCAL"
throw java.lang.RuntimeException() throw RuntimeException()
"OK_LOCAL" "OK_LOCAL"
}, },
{ {
@@ -113,17 +113,17 @@ fun test3(h: Holder): String {
val localResult = doCall ( val localResult = doCall (
{ {
h.value += "OK_LOCAL" h.value += "OK_LOCAL"
throw java.lang.RuntimeException("FAIL") throw RuntimeException("FAIL")
"OK_LOCAL" "OK_LOCAL"
}, },
{ {
h.value += ", OK_EXCEPTION" h.value += ", OK_EXCEPTION"
throw java.lang.RuntimeException("FAIL_EX") throw RuntimeException("FAIL_EX")
"OK_EXCEPTION" "OK_EXCEPTION"
}, },
{ {
h.value += ", OK_FINALLY" h.value += ", OK_FINALLY"
throw java.lang.RuntimeException("FINALLY") throw RuntimeException("FINALLY")
"OK_FINALLY" "OK_FINALLY"
}) })
} catch (e: RuntimeException) { } catch (e: RuntimeException) {
@@ -142,12 +142,12 @@ fun test4(h: Holder): String {
val localResult = doCall2 ( val localResult = doCall2 (
{ {
h.value += "OK_LOCAL" h.value += "OK_LOCAL"
throw java.lang.RuntimeException("FAIL") throw RuntimeException("FAIL")
"OK_LOCAL" "OK_LOCAL"
}, },
{ {
h.value += ", OK_EXCEPTION" h.value += ", OK_EXCEPTION"
throw java.lang.RuntimeException("EXCEPTION") throw RuntimeException("EXCEPTION")
"OK_EXCEPTION" "OK_EXCEPTION"
}, },
{ {
@@ -17,9 +17,9 @@ public class Holder(var value: String = "") {
} }
public class Exception1(message: String) : java.lang.RuntimeException(message) public class Exception1(message: String) : RuntimeException(message)
public class Exception2(message: String) : java.lang.RuntimeException(message) public class Exception2(message: String) : RuntimeException(message)
public inline fun doCall(block: ()-> String, finallyBlock: ()-> String, public inline fun doCall(block: ()-> String, finallyBlock: ()-> String,
tryBlock2: ()-> String, catchBlock2: ()-> String, res: String = "Fail") : String { tryBlock2: ()-> String, catchBlock2: ()-> String, res: String = "Fail") : String {