Skip to content

Commit

Permalink
Add additional BashExitCode tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mbovel committed May 6, 2024
1 parent d39973c commit 1073b4f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions compiler/test/dotty/tools/scripting/BashExitCodeTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,24 @@ class BashExitCodeTests:

@Test def neg = scalac(f("@main def Test = prin"))(1)
@Test def run = scalac(f("@main def Test = ???"))(0) & scala("-classpath", tmpDir, "Test")(1)
@Test def pos = scalac(f("@main def Test = ()"))(0) & scala("-classpath", tmpDir, "Test")(0)
@Test def pos1 = scalac(f("@main def Test = ()"))(0) & scala("-classpath", tmpDir, "Test")(0)
@Test def pos2 = scalac(f("@main def test = ()"))(0) & scala("-classpath", tmpDir, "test")(0)
@Test def pos3 = scalac(f("object Test { def main(args: Array[String]) = () }"))(0) & scala("-classpath", tmpDir, "Test")(0)
@Test def pos4 = scalac(f("object test { def main(args: Array[String]) = () }"))(0) & scala("-classpath", tmpDir, "test")(0)

@Test def runNeg = scala(f("@main def Test = prin", ".sc"))(1)
@Test def runRun = scala(f("@main def Test = ???", ".sc"))(1)
@Test def runPos = scala(f("@main def Test = ()", ".sc"))(0)
@Test def runPos1 = scala(f("@main def Test = ()", ".sc"))(0)
@Test def runPos2 = scala(f("@main def test = ()", ".sc"))(0)
@Test def runPos3 = scala(f("object Test { def main(args: Array[String]) = () }", ".sc"))(0)
@Test def runPos4 = scala(f("object test { def main(args: Array[String]) = () }", ".sc"))(0)

@Test def scNeg = scalac("-script", f("@main def Test = prin", ".sc"))(1)
@Test def scRun = scalac("-script", f("@main def Test = ???", ".sc"))(1)
@Test def scPos = scalac("-script", f("@main def Test = ()", ".sc"))(0)
@Test def scPos1 = scalac("-script", f("@main def Test = ()", ".sc"))(0)
@Test def scPos2 = scalac("-script", f("@main def test = ()", ".sc"))(0)
@Test def scPos3 = scalac("-script", f("object Test { def main(args: Array[String]) = () }", ".sc"))(0)
@Test def scPos4 = scalac("-script", f("object test { def main(args: Array[String]) = () }", ".sc"))(0)

@Test def evalNeg = scala("-e", "'prinln(10*10)'")(1)
@Test def evalRun = scala("-e", "'1/0'")(1)
Expand Down

0 comments on commit 1073b4f

Please sign in to comment.