@@ -2163,21 +2163,43 @@ abstract class BspTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
2163
2163
}
2164
2164
}
2165
2165
2166
- // TODO: uncomment when the fix for https://github.com/VirtusLab/scala-cli/issues/3157 is on nightly
2167
- // test("setup-ide prepares a valid BSP configuration with --cli-version") {
2168
- // val scriptName = "cli-version.sc"
2169
- // val cliVersion = "nightly"
2170
- // val inputs = TestInputs(os.rel / scriptName -> s"""println("Hello from launcher v$cliVersion""")
2171
- // inputs.fromRoot { root =>
2172
- // val cliVersionArgs = List("--cli-version", cliVersion)
2173
- // os.proc(TestUtil.cli, cliVersionArgs, "setup-ide", scriptName, extraOptions).call(cwd = root)
2174
- // val expectedIdeLauncherFile = root / Constants.workspaceDirName / "ide-launcher-options.json"
2175
- // expect(expectedIdeLauncherFile.toNIO.toFile.exists())
2176
- // expect(os.read(expectedIdeLauncherFile).contains(cliVersion))
2177
- // val bspConfig = readBspConfig(root)
2178
- // expect(bspConfig.argv.head == TestUtil.cliPath)
2179
- // expect(bspConfig.argv.containsSlice(cliVersionArgs))
2180
- // expect(bspConfig.argv.indexOfSlice(cliVersionArgs) < bspConfig.argv.indexOf("bsp"))
2181
- // }
2182
- // }
2166
+ for { cliVersion <- Seq (" 1.5.0" , " 1.5.0-19-g932866db6-SNAPSHOT" , " 1.0.0" ) }
2167
+ test(s " setup-ide doesn't pass unrecognised arguments to old --cli-versions: $cliVersion" ) {
2168
+ val scriptName = " cli-version.sc"
2169
+ val inputs = TestInputs (
2170
+ os.rel / scriptName -> s """ println("Hello from launcher v $cliVersion"""
2171
+ )
2172
+ inputs.fromRoot { root =>
2173
+ val r =
2174
+ os.proc(TestUtil .cli, " --cli-version" , cliVersion, " setup-ide" , scriptName, extraOptions)
2175
+ .call(cwd = root, stderr = os.Pipe , check = false )
2176
+ expect(! r.err.text().contains(" Unrecognized argument" ))
2177
+ expect(r.exitCode == 0 )
2178
+ }
2179
+ }
2180
+
2181
+ // TODO: test for the most recent CLI version as well when 1.5.1 is out
2182
+ for { cliVersion <- Seq (" 1.5.0-34-g31a88e428-SNAPSHOT" ) }
2183
+ test(
2184
+ s " setup-ide prepares a valid BSP configuration with --cli-version $cliVersion"
2185
+ ) {
2186
+ val scriptName = " cli-version.sc"
2187
+ val inputs = TestInputs (
2188
+ os.rel / scriptName -> s """ println("Hello from launcher v $cliVersion"""
2189
+ )
2190
+ inputs.fromRoot { root =>
2191
+ val cliVersionArgs = List (" --cli-version" , cliVersion)
2192
+ os.proc(TestUtil .cli, cliVersionArgs, " setup-ide" , scriptName, extraOptions).call(cwd =
2193
+ root
2194
+ )
2195
+ val expectedIdeLauncherFile =
2196
+ root / Constants .workspaceDirName / " ide-launcher-options.json"
2197
+ expect(expectedIdeLauncherFile.toNIO.toFile.exists())
2198
+ expect(os.read(expectedIdeLauncherFile).contains(cliVersion))
2199
+ val bspConfig = readBspConfig(root)
2200
+ expect(bspConfig.argv.head == TestUtil .cliPath)
2201
+ expect(bspConfig.argv.containsSlice(cliVersionArgs))
2202
+ expect(bspConfig.argv.indexOfSlice(cliVersionArgs) < bspConfig.argv.indexOf(" bsp" ))
2203
+ }
2204
+ }
2183
2205
}
0 commit comments