Skip to content

Commit

Permalink
Add repl tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Linyxus committed Dec 16, 2024
1 parent 2e409e1 commit c79b212
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions compiler/test/dotty/tools/repl/ReplCompilerTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,24 @@ class ReplCompilerTests extends ReplTest:
assertTrue(all.head.startsWith("-- [E103] Syntax Error"))
assertTrue(all.exists(_.trim().startsWith("| Illegal start of statement: this modifier is not allowed here")))

@Test def `i16250a`: Unit = initially:
val hints = List(
"this language import is not allowed in the REPL",
"To use this language feature, include the flag `-language:experimental.captureChecking` when starting the REPL"
)
run("import language.experimental.captureChecking")
val all = lines()
assertTrue(hints.forall(hint => all.exists(_.contains(hint))))

@Test def `i16250b`: Unit = initially:
val hints = List(
"this language import is not allowed in the REPL",
"To use this language feature, include the flag `-language:experimental.pureFunctions` when starting the REPL"
)
run("import language.experimental.pureFunctions")
val all = lines()
assertTrue(hints.forall(hint => all.exists(_.contains(hint))))

object ReplCompilerTests:

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

0 comments on commit c79b212

Please sign in to comment.