Skip to content

Commit c79b212

Browse files
committed
Add repl tests
1 parent 2e409e1 commit c79b212

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: compiler/test/dotty/tools/repl/ReplCompilerTests.scala

+18
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,24 @@ class ReplCompilerTests extends ReplTest:
493493
assertTrue(all.head.startsWith("-- [E103] Syntax Error"))
494494
assertTrue(all.exists(_.trim().startsWith("| Illegal start of statement: this modifier is not allowed here")))
495495

496+
@Test def `i16250a`: Unit = initially:
497+
val hints = List(
498+
"this language import is not allowed in the REPL",
499+
"To use this language feature, include the flag `-language:experimental.captureChecking` when starting the REPL"
500+
)
501+
run("import language.experimental.captureChecking")
502+
val all = lines()
503+
assertTrue(hints.forall(hint => all.exists(_.contains(hint))))
504+
505+
@Test def `i16250b`: Unit = initially:
506+
val hints = List(
507+
"this language import is not allowed in the REPL",
508+
"To use this language feature, include the flag `-language:experimental.pureFunctions` when starting the REPL"
509+
)
510+
run("import language.experimental.pureFunctions")
511+
val all = lines()
512+
assertTrue(hints.forall(hint => all.exists(_.contains(hint))))
513+
496514
object ReplCompilerTests:
497515

498516
private val pattern = Pattern.compile("\\r[\\n]?|\\n");

0 commit comments

Comments
 (0)