Skip to content

Commit cbdb444

Browse files
committed
Add integration test for handling errors
1 parent 5d2a5f4 commit cbdb444

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

modules/integration/src/test/scala/scala/cli/integration/RunTestDefinitions.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,6 +2219,23 @@ abstract class RunTestDefinitions(val scalaVersionOpt: Option[String])
22192219
}
22202220
}
22212221

2222+
if (actualScalaVersion.startsWith("3"))
2223+
test("should throw exception for code compiled by scala 3.1.3") {
2224+
val exceptionMsg = "Throw exception in Scala"
2225+
val inputs = TestInputs(
2226+
os.rel / "hello.sc" ->
2227+
s"""//> using scala "3.1.3"
2228+
|throw new Exception("$exceptionMsg")""".stripMargin
2229+
)
2230+
2231+
inputs.fromRoot { root =>
2232+
val res =
2233+
os.proc(TestUtil.cli, "hello.sc").call(cwd = root, mergeErrIntoOut = true, check = false)
2234+
val output = res.out.trim()
2235+
expect(output.contains(exceptionMsg))
2236+
}
2237+
}
2238+
22222239
private def maybeScalapyPrefix =
22232240
if (actualScalaVersion.startsWith("2.13.")) ""
22242241
else "import me.shadaj.scalapy.py" + System.lineSeparator()

0 commit comments

Comments
 (0)