Skip to content

Commit bcbbbc0

Browse files
committed
Make test t6827 less flaky
It failed once on the CI on OpenJDK 8 because the toString of the exception was "java.lang.ArrayIndexOutOfBoundsException" instead of "java.lang.ArrayIndexOutOfBoundsException:-1" (https://dotty-ci.epfl.ch/lampepfl/dotty/982/1/4). I have no idea how this could happen (different code paths between the interpreted and JIT compiled code ?), so just stop checking for the exact toString output.
1 parent ba87027 commit bcbbbc0

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

tests/run/t6827.check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
start at -5: java.lang.ArrayIndexOutOfBoundsException: -5
2-
start at -1: java.lang.ArrayIndexOutOfBoundsException: -1
1+
start at -5: OOB
2+
start at -1: OOB
33
start at limit: ok
44
start at limit-1: ok
55
first 10: ok

tests/run/t6827.scala

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,9 @@ object Test extends App {
99
"ok"
1010
} catch {
1111
case e: ArrayIndexOutOfBoundsException =>
12-
// Special-case printing this exception because the toString changed in Java 11
13-
val java11toString = """java.lang.ArrayIndexOutOfBoundsException: Index (-?\d+).*""".r
14-
15-
e.toString match {
16-
case java11toString(index) =>
17-
s"java.lang.ArrayIndexOutOfBoundsException: $index"
18-
case str =>
19-
str
20-
}
21-
case e: Exception => e.toString
12+
"OOB"
13+
case e: Exception =>
14+
e.toString
2215
}
2316
println("%s: %s" format (label, status))
2417
}

0 commit comments

Comments
 (0)