Skip to content

Commit 65e141e

Browse files
committed
do not check exceptions messages, they might change across platforms
The exact format is not part of the specification of the constructors (see https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/IndexOutOfBoundsException.html#%3Cinit%3E(int))
1 parent 5dda587 commit 65e141e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

tests/run/1938.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ object Test {
3939
l.productElement(23)
4040
???
4141
} catch {
42-
case e: IndexOutOfBoundsException => assert(e.getMessage == "23")
42+
case e: IndexOutOfBoundsException => assert(e.getMessage.contains("23"))
43+
case _ => assert(false)
4344
}
4445
}
4546
}

tests/run/i2314.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ object Test {
1818
a.productElement(-1)
1919
???
2020
} catch {
21-
case e: IndexOutOfBoundsException =>
22-
assert(e.getMessage == "-1")
21+
case e: IndexOutOfBoundsException => assert(e.getMessage().contains("-1"))
22+
case _ => assert(false)
2323
}
2424
try {
2525
a.productElement(2)
2626
???
2727
} catch {
28-
case e: IndexOutOfBoundsException =>
29-
assert(e.getMessage == "2")
28+
case e: IndexOutOfBoundsException => assert(e.getMessage().contains("2"))
29+
case _ => assert(false)
3030
}
3131

3232
val b = B(1, "s")

0 commit comments

Comments
 (0)