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:
Ilya Gorbunov
2016-08-12 20:21:35 +03:00
parent 3115aa1dc2
commit 2a0076d9bd
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -16,8 +16,8 @@ fun bbb() {
fun foo(<warning>expr</warning>: StringBuilder): Int {
val c = 'a'
when(c) {
0.toChar() -> throw Exception("zero")
else -> throw Exception("nonzero" + c)
0.toChar() -> throw Throwable("zero")
else -> throw Throwable("nonzero" + c)
}
}
+1 -1
View File
@@ -34,7 +34,7 @@ fun test(<warning>l</warning> : List<Int>) {
try {
// ...
}
catch(e: Exception) {
catch(e: Throwable) {
System.out.println(e.message)
}
+3 -3
View File
@@ -9,15 +9,15 @@ fun takeFirst(expr: StringBuilder): Char {
}
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>)
if (c >= '0' && c <= '9') {
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)
return n
}
throw Exception("Syntax error: Unrecognized character " + c)
throw Throwable("Syntax error: Unrecognized character " + c)
}
fun evaluateAdd(expr: StringBuilder, numbers: ArrayList<Int>): Int {
+1 -1
View File
@@ -4,7 +4,7 @@ class MyClass {
@Deprecated("Use A instead") operator fun MyClass.rangeTo(i: MyClass): Iterable<Int> {
i.i
throw Exception()
throw Throwable()
}
fun test() {