Skip to content

Commit 96791ee

Browse files
committed
Fix and disable REPL tests that test exceptions
1 parent d189fa8 commit 96791ee

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

compiler/test/dotty/tools/repl/ReplCompilerTests.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package dotty.tools
22
package repl
33

44
import org.junit.Assert._
5-
import org.junit.Test
5+
import org.junit.{Test, Ignore}
66

77
import dotc.core.Contexts.Context
88
import dotc.ast.Trees._
@@ -93,27 +93,27 @@ class ReplCompilerTests extends ReplTest {
9393
)
9494
}
9595

96-
@Test def i3305: Unit = {
96+
// FIXME: Tests are not run in isolation, the classloader is corrupted after the first exception
97+
@Ignore def i3305: Unit = {
9798
fromInitialState { implicit s =>
9899
compile("null.toString")
99-
storedOutput().startsWith("java.lang.NullPointerException")
100+
assertTrue(storedOutput().startsWith("java.lang.NullPointerException"))
100101
}
101102

102103
fromInitialState { implicit s =>
103104
compile("def foo: Int = 1 + foo; foo")
104-
storedOutput().startsWith("def foo: Int\njava.lang.StackOverflowError")
105+
assertTrue(storedOutput().startsWith("def foo: Int\njava.lang.StackOverflowError"))
105106
}
106107

107108
fromInitialState { implicit s =>
108109
compile("""throw new IllegalArgumentException("Hello")""")
109-
storedOutput().startsWith("java.lang.IllegalArgumentException: Hello")
110+
assertTrue(storedOutput().startsWith("java.lang.IllegalArgumentException: Hello"))
110111
}
111112

112-
// FIXME
113-
// fromInitialState { implicit s =>
114-
// compile("val (x, y) = null")
115-
// storedOutput().startsWith("scala.MatchError: null")
116-
// }
113+
fromInitialState { implicit s =>
114+
compile("val (x, y) = null")
115+
assertTrue(storedOutput().startsWith("scala.MatchError: null"))
116+
}
117117
}
118118

119119
@Test def i2789: Unit = fromInitialState { implicit state =>

0 commit comments

Comments
 (0)