@@ -1356,59 +1356,20 @@ abstract class PackageTestDefinitions extends ScalaCliSuite with TestScalaVersio
1356
1356
packageDescription = packageOpts.headOption.getOrElse(" bootstrap" )
1357
1357
} {
1358
1358
test(s " package with main method in test scope ( $packageDescription) " ) {
1359
- val mainClass = " TestScopeMain"
1360
- val testScopeFileName = s " $mainClass.test.scala "
1361
- val message = " Hello"
1362
- val outputFile = mainClass + extension
1363
- TestInputs (
1364
- os.rel / " Messages.scala" -> s """ object Messages { val msg = " $message" } """ ,
1365
- os.rel / testScopeFileName -> s """ object $mainClass extends App { println(Messages.msg) } """
1366
- ).fromRoot { root =>
1367
- os.proc(
1368
- TestUtil .cli,
1369
- " --power" ,
1370
- " package" ,
1371
- " --test" ,
1372
- extraOptions,
1373
- " ." ,
1374
- packageOpts
1375
- )
1376
- .call(cwd = root)
1377
- val outputFilePath = root / outputFile
1378
- expect(os.isFile(outputFilePath))
1379
- val output =
1380
- if (packageDescription == libraryArg)
1381
- os.proc(TestUtil .cli, " run" , outputFilePath).call(cwd = root).out.trim()
1382
- else if (packageDescription == jsArg)
1383
- os.proc(node, outputFilePath).call(cwd = root).out.trim()
1384
- else {
1385
- expect(Files .isExecutable(outputFilePath.toNIO))
1386
- TestUtil .maybeUseBash(outputFilePath)(cwd = root).out.trim()
1387
- }
1388
- expect(output == message)
1389
- }
1390
- }
1391
-
1392
- if (actualScalaVersion == Constants .scala3Next)
1393
- test(s " package ( $packageDescription, --cross) " ) {
1394
- val crossDirective =
1395
- s " //> using scala $actualScalaVersion ${Constants .scala213} ${Constants .scala212}"
1396
- val mainClass = " TestScopeMain"
1397
- val mainFile = s " $mainClass.scala "
1398
- val message = " Hello"
1399
- val outputFile = mainClass + extension
1359
+ TestUtil .retryOnCi() {
1360
+ val mainClass = " TestScopeMain"
1361
+ val testScopeFileName = s " $mainClass.test.scala "
1362
+ val message = " Hello"
1363
+ val outputFile = mainClass + extension
1400
1364
TestInputs (
1401
- os.rel / " Messages.scala" ->
1402
- s """ $crossDirective
1403
- |object Messages { val msg = " $message" } """ .stripMargin,
1404
- os.rel / mainFile ->
1405
- s """ object $mainClass extends App { println(Messages.msg) } """ .stripMargin
1365
+ os.rel / " Messages.scala" -> s """ object Messages { val msg = " $message" } """ ,
1366
+ os.rel / testScopeFileName -> s """ object $mainClass extends App { println(Messages.msg) } """
1406
1367
).fromRoot { root =>
1407
1368
os.proc(
1408
1369
TestUtil .cli,
1409
1370
" --power" ,
1410
1371
" package" ,
1411
- " --cross " ,
1372
+ " --test " ,
1412
1373
extraOptions,
1413
1374
" ." ,
1414
1375
packageOpts
@@ -1428,6 +1389,49 @@ abstract class PackageTestDefinitions extends ScalaCliSuite with TestScalaVersio
1428
1389
expect(output == message)
1429
1390
}
1430
1391
}
1392
+ }
1393
+
1394
+ if (actualScalaVersion == Constants .scala3Next)
1395
+ test(s " package ( $packageDescription, --cross) " ) {
1396
+ TestUtil .retryOnCi() {
1397
+ val crossDirective =
1398
+ s " //> using scala $actualScalaVersion ${Constants .scala213} ${Constants .scala212}"
1399
+ val mainClass = " TestScopeMain"
1400
+ val mainFile = s " $mainClass.scala "
1401
+ val message = " Hello"
1402
+ val outputFile = mainClass + extension
1403
+ TestInputs (
1404
+ os.rel / " Messages.scala" ->
1405
+ s """ $crossDirective
1406
+ |object Messages { val msg = " $message" } """ .stripMargin,
1407
+ os.rel / mainFile ->
1408
+ s """ object $mainClass extends App { println(Messages.msg) } """ .stripMargin
1409
+ ).fromRoot { root =>
1410
+ os.proc(
1411
+ TestUtil .cli,
1412
+ " --power" ,
1413
+ " package" ,
1414
+ " --cross" ,
1415
+ extraOptions,
1416
+ " ." ,
1417
+ packageOpts
1418
+ )
1419
+ .call(cwd = root)
1420
+ val outputFilePath = root / outputFile
1421
+ expect(os.isFile(outputFilePath))
1422
+ val output =
1423
+ if (packageDescription == libraryArg)
1424
+ os.proc(TestUtil .cli, " run" , outputFilePath).call(cwd = root).out.trim()
1425
+ else if (packageDescription == jsArg)
1426
+ os.proc(node, outputFilePath).call(cwd = root).out.trim()
1427
+ else {
1428
+ expect(Files .isExecutable(outputFilePath.toNIO))
1429
+ TestUtil .maybeUseBash(outputFilePath)(cwd = root).out.trim()
1430
+ }
1431
+ expect(output == message)
1432
+ }
1433
+ }
1434
+ }
1431
1435
}
1432
1436
}
1433
1437
}
0 commit comments