Test data: replace Exception with Throwable (in those tests where particular exception type is not crucial in order not to rename tests to have runtime dependency added with exception typealiases).
This commit is contained in:
+2
-2
@@ -16,8 +16,8 @@ fun bbb() {
|
|||||||
fun foo(<warning>expr</warning>: StringBuilder): Int {
|
fun foo(<warning>expr</warning>: StringBuilder): Int {
|
||||||
val c = 'a'
|
val c = 'a'
|
||||||
when(c) {
|
when(c) {
|
||||||
0.toChar() -> throw Exception("zero")
|
0.toChar() -> throw Throwable("zero")
|
||||||
else -> throw Exception("nonzero" + c)
|
else -> throw Throwable("nonzero" + c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ fun test(<warning>l</warning> : List<Int>) {
|
|||||||
try {
|
try {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
catch(e: Exception) {
|
catch(e: Throwable) {
|
||||||
System.out.println(e.message)
|
System.out.println(e.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -9,15 +9,15 @@ fun takeFirst(expr: StringBuilder): Char {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun evaluateArg(expr: CharSequence, numbers: ArrayList<Int>): Int {
|
fun evaluateArg(expr: CharSequence, numbers: ArrayList<Int>): Int {
|
||||||
if (expr.length == 0) throw Exception("Syntax error: Character expected");
|
if (expr.length == 0) throw Throwable("Syntax error: Character expected");
|
||||||
val c = takeFirst(<error>expr</error>)
|
val c = takeFirst(<error>expr</error>)
|
||||||
if (c >= '0' && c <= '9') {
|
if (c >= '0' && c <= '9') {
|
||||||
val n = c - '0'
|
val n = c - '0'
|
||||||
if (!numbers.contains(n)) throw Exception("You used incorrect number: " + n)
|
if (!numbers.contains(n)) throw Throwable("You used incorrect number: " + n)
|
||||||
numbers.remove(n)
|
numbers.remove(n)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
throw Exception("Syntax error: Unrecognized character " + c)
|
throw Throwable("Syntax error: Unrecognized character " + c)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int {
|
fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int {
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ class MyClass {
|
|||||||
|
|
||||||
@Deprecated("Use A instead") operator fun MyClass.rangeTo(i: MyClass): Iterable<Int> {
|
@Deprecated("Use A instead") operator fun MyClass.rangeTo(i: MyClass): Iterable<Int> {
|
||||||
i.i
|
i.i
|
||||||
throw Exception()
|
throw Throwable()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
Reference in New Issue
Block a user