Skip to content

Commit

Permalink
Merge pull request #868 from romanowski/repl-fixes
Browse files Browse the repository at this point in the history
Start repl with scalac options
  • Loading branch information
romanowski authored Apr 12, 2022
2 parents a44afc9 + 08c2785 commit 7e92b92
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/cli/src/main/scala/scala/cli/commands/Repl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,13 @@ object Repl extends ScalaCommand[ReplOptions] {
" These will not be accessible from the REPL."
)

val replArgs = options.notForBloopOptions.replOptions.ammoniteArgs ++ programArgs
val additionalArgs =
if (options.notForBloopOptions.replOptions.useAmmonite)
options.notForBloopOptions.replOptions.ammoniteArgs
else
options.scalaOptions.scalacOptions.toSeq.map(_.value.value)

val replArgs = additionalArgs ++ programArgs

if (dryRun)
logger.message("Dry run, not running REPL.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package scala.cli.integration

import com.eed3si9n.expecty.Expecty.expect

class ReplTests extends munit.FunSuite {

test("calling repl with -Xshow-phases flag") {
val cmd = Seq[os.Shellable](
TestUtil.cli,
"repl",
"-Xshow-phases"
)

val builder = new StringBuilder
val readLines = os.ProcessOutput.Readlines(s => builder.append(s))
val res = os.proc(cmd).call(stdout = readLines, stderr = readLines)
expect(res.exitCode == 0)
val output = builder.mkString
expect(output.contains("parser") && output.contains("typer"))
}

}

0 comments on commit 7e92b92

Please sign in to comment.