From 9c0b91d24b8602743147a04995d2e3a57d7b84c0 Mon Sep 17 00:00:00 2001 From: Piotr Chabelski Date: Fri, 14 Mar 2025 07:44:50 +0100 Subject: [PATCH] Add support for running the `test` sub-command with the bisect script (#22796) Example usage: ```bash scala project/scripts/bisect.scala --jvm 17 -- --bootstrapped --releases 3.6.4-RC1-bin-20241120-bd07317-NIGHTLY... test smth.test.scala ``` `smth.test.scala` ```scala //> using dep org.scalameta::munit::1.1.0 //> using platform js class MyTests extends munit.FunSuite { test("foo") { assert(2 + 2 == 4) } } ``` Allowed to bisect https://github.com/scala/scala3/issues/22794 [Cherry-picked c9eaa14115c2654db4f54294b0571bc28a6051a4] --- project/scripts/bisect.scala | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/project/scripts/bisect.scala b/project/scripts/bisect.scala index d920dfd528a1..fb53807f62b6 100755 --- a/project/scripts/bisect.scala +++ b/project/scripts/bisect.scala @@ -20,6 +20,7 @@ val usageMessage = """ |The should be one of: |* compile ... |* run ... + |* test ... |* | |The arguments for 'compile' and 'run' should be paths to the source file(s) and optionally additional options passed directly to scala-cli. @@ -100,6 +101,7 @@ object ScriptOptions: enum ValidationCommand: case Compile(args: Seq[String]) case Run(args: Seq[String]) + case Test(args: Seq[String]) case CustomValidationScript(scriptFile: File) def validationScript: File = this match @@ -107,6 +109,8 @@ enum ValidationCommand: ValidationScript.tmpScalaCliScript(command = "compile", args) case Run(args) => ValidationScript.tmpScalaCliScript(command = "run", args) + case Test(args) => + ValidationScript.tmpScalaCliScript(command = "test", args) case CustomValidationScript(scriptFile) => ValidationScript.copiedFrom(scriptFile) @@ -114,6 +118,7 @@ object ValidationCommand: def fromArgs(args: Seq[String]) = args match case Seq("compile", commandArgs*) => Compile(commandArgs) case Seq("run", commandArgs*) => Run(commandArgs) + case Seq("test", commandArgs*) => Test(commandArgs) case Seq(path) => CustomValidationScript(new File(path))