@@ -309,19 +309,11 @@ trait BuildMacros extends ScalaCliCrossSbtModule
309
309
}
310
310
311
311
object test extends ScalaCliTests {
312
-
313
- // Is there a better way to add task dependency to test?
314
- def test (args : String * ): Command [(String , Seq [TestResult ])] = Task .Command {
315
- val res = super .test(args : _* )()
316
- testNegativeCompilation()()
317
- res
318
- }
319
-
320
312
def scalacOptions : Target [Seq [String ]] = Task {
321
313
super .scalacOptions() ++ asyncScalacOptions(scalaVersion())
322
314
}
323
315
324
- def testNegativeCompilation (): Command [Unit ] = Task .Command {
316
+ def testNegativeCompilation (): Command [Unit ] = Task .Command (exclusive = true ) {
325
317
val base = Task .workspace / " modules" / " build-macros" / " src"
326
318
val negativeTests = Seq (
327
319
" MismatchedLeft.scala" -> Seq (
@@ -331,8 +323,11 @@ trait BuildMacros extends ScalaCliCrossSbtModule
331
323
)
332
324
)
333
325
334
- val cpsSource = base / " main" / " scala" / " scala" / " build" / " EitherCps.scala"
335
- assert(os.exists(cpsSource))
326
+ val cpsSource = base / " main" / " scala" / " scala" / " build" / " EitherCps.scala"
327
+ val cpsSourceExists = os.exists(cpsSource)
328
+ if (! cpsSourceExists) System .err.println(s " Expected source file $cpsSource does not exist " )
329
+ else System .err.println(s " Found source file $cpsSource" )
330
+ assert(cpsSourceExists)
336
331
337
332
val sv = scalaVersion()
338
333
def compile (extraSources : os.Path * ): CommandResult =
@@ -341,7 +336,14 @@ trait BuildMacros extends ScalaCliCrossSbtModule
341
336
mergeErrIntoOut = true ,
342
337
cwd = Task .workspace
343
338
)
344
- assert(0 == compile().exitCode)
339
+ val compileResult = compile()
340
+ if (compileResult.exitCode != 0 ) {
341
+ System .err.println(s " Compilation failed: $cpsSource" )
342
+ System .err.println(compileResult.out.text())
343
+ }
344
+ else
345
+ System .err.println(s " Compiled $cpsSource successfully " )
346
+ assert(0 == compileResult.exitCode)
345
347
346
348
val notPassed = negativeTests.filter { case (testName, expectedErrors) =>
347
349
val testFile = base / " negative-tests" / testName
0 commit comments