Skip to content

Commit d96e255

Browse files
authored
Merge pull request #3753 from dotty-staging/fix-#2789
Fix #2789
2 parents 284eee7 + 96791ee commit d96e255

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

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

Lines changed: 15 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,26 +93,31 @@ 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+
}
117+
}
118+
119+
@Test def i2789: Unit = fromInitialState { implicit state =>
120+
compile("(x: Int) => println(x)")
121+
assertTrue(storedOutput().startsWith("val res0: Int => Unit ="))
117122
}
118123
}

0 commit comments

Comments
 (0)