|
1 | 1 | package dotty.tools.repl |
2 | 2 |
|
3 | | -import org.junit.Assert._ |
| 3 | +import org.junit.Assert.{assertTrue => assert, _} |
4 | 4 | import org.junit.{Ignore, Test} |
5 | 5 |
|
6 | 6 | class ReplCompilerTests extends ReplTest { |
@@ -85,33 +85,33 @@ class ReplCompilerTests extends ReplTest { |
85 | 85 | @Ignore @Test def i3305: Unit = { |
86 | 86 | fromInitialState { implicit s => |
87 | 87 | run("null.toString") |
88 | | - assertTrue(storedOutput().startsWith("java.lang.NullPointerException")) |
| 88 | + assert(storedOutput().startsWith("java.lang.NullPointerException")) |
89 | 89 | } |
90 | 90 |
|
91 | 91 | fromInitialState { implicit s => |
92 | 92 | run("def foo: Int = 1 + foo; foo") |
93 | | - assertTrue(storedOutput().startsWith("def foo: Int\njava.lang.StackOverflowError")) |
| 93 | + assert(storedOutput().startsWith("def foo: Int\njava.lang.StackOverflowError")) |
94 | 94 | } |
95 | 95 |
|
96 | 96 | fromInitialState { implicit s => |
97 | 97 | run("""throw new IllegalArgumentException("Hello")""") |
98 | | - assertTrue(storedOutput().startsWith("java.lang.IllegalArgumentException: Hello")) |
| 98 | + assert(storedOutput().startsWith("java.lang.IllegalArgumentException: Hello")) |
99 | 99 | } |
100 | 100 |
|
101 | 101 | fromInitialState { implicit s => |
102 | 102 | run("val (x, y) = null") |
103 | | - assertTrue(storedOutput().startsWith("scala.MatchError: null")) |
| 103 | + assert(storedOutput().startsWith("scala.MatchError: null")) |
104 | 104 | } |
105 | 105 | } |
106 | 106 |
|
107 | 107 | @Test def i2789: Unit = fromInitialState { implicit state => |
108 | 108 | run("(x: Int) => println(x)") |
109 | | - assertTrue(storedOutput().startsWith("val res0: Int => Unit =")) |
| 109 | + assert(storedOutput().startsWith("val res0: Int => Unit =")) |
110 | 110 | } |
111 | 111 |
|
112 | 112 | @Test def byNameParam: Unit = fromInitialState { implicit state => |
113 | 113 | run("def f(g: => Int): Int = g") |
114 | | - assertTrue(storedOutput().startsWith("def f(g: => Int): Int")) |
| 114 | + assert(storedOutput().startsWith("def f(g: => Int): Int")) |
115 | 115 | } |
116 | 116 |
|
117 | 117 | @Test def i4051 = fromInitialState { implicit state => |
@@ -163,9 +163,14 @@ class ReplCompilerTests extends ReplTest { |
163 | 163 | storedOutput().trim |
164 | 164 | ) |
165 | 165 | run("IntOrd") |
166 | | - assertTrue(storedOutput().startsWith("val res0: IntOrd.type =")) |
| 166 | + assert(storedOutput().startsWith("val res0: IntOrd.type =")) |
167 | 167 | } |
168 | 168 |
|
| 169 | + @Test def i7934: Unit = fromInitialState { state => |
| 170 | + implicit val ctx = state.context |
| 171 | + assertFalse(ParseResult.isIncomplete("_ + 1")) // was: assertThrows[NullPointerException] |
| 172 | + } |
| 173 | + |
169 | 174 | @Test def testSingletonPrint = fromInitialState { implicit state => |
170 | 175 | run("""val a = "hello"; val x: a.type = a""") |
171 | 176 | assertEquals("val a: String = hello\nval x: a.type = hello", storedOutput().trim) |
|
0 commit comments