Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions compiler/test/dotty/tools/repl/ReplCompilerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dotty.tools
package repl

import org.junit.Assert._
import org.junit.Test
import org.junit.{Test, Ignore}

import dotc.core.Contexts.Context
import dotc.ast.Trees._
Expand Down Expand Up @@ -93,26 +93,31 @@ class ReplCompilerTests extends ReplTest {
)
}

@Test def i3305: Unit = {
// FIXME: Tests are not run in isolation, the classloader is corrupted after the first exception
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open an issue for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ignore def i3305: Unit = {
fromInitialState { implicit s =>
compile("null.toString")
storedOutput().startsWith("java.lang.NullPointerException")
assertTrue(storedOutput().startsWith("java.lang.NullPointerException"))
}

fromInitialState { implicit s =>
compile("def foo: Int = 1 + foo; foo")
storedOutput().startsWith("def foo: Int\njava.lang.StackOverflowError")
assertTrue(storedOutput().startsWith("def foo: Int\njava.lang.StackOverflowError"))
}

fromInitialState { implicit s =>
compile("""throw new IllegalArgumentException("Hello")""")
storedOutput().startsWith("java.lang.IllegalArgumentException: Hello")
assertTrue(storedOutput().startsWith("java.lang.IllegalArgumentException: Hello"))
}

// FIXME
// fromInitialState { implicit s =>
// compile("val (x, y) = null")
// storedOutput().startsWith("scala.MatchError: null")
// }
fromInitialState { implicit s =>
compile("val (x, y) = null")
assertTrue(storedOutput().startsWith("scala.MatchError: null"))
}
}

@Test def i2789: Unit = fromInitialState { implicit state =>
compile("(x: Int) => println(x)")
assertTrue(storedOutput().startsWith("val res0: Int => Unit ="))
}
}