Skip to content

Commit e7d7e4e

Browse files
committed
review fixes
1 parent 301c78a commit e7d7e4e

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

src/main/kotlin/file/SetupApp.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ object SetupApp {
371371
return
372372
}
373373
if (setup.quiet) {
374-
val diagnostics = quietCompilerDiagnostics(result.output)
374+
val diagnostics = quietCompilerFailureOutput(result.output, setup.debug)
375375
diagnostics.forEach { System.err.println(it) }
376376
fail("❌ Wurst $commandName failed. (Errors: ${quietCompilerErrorCount(result.output, diagnostics)})")
377377
return
@@ -408,6 +408,10 @@ object SetupApp {
408408
return true
409409
}
410410

411+
internal fun quietCompilerFailureOutput(output: List<String>, debug: Boolean): List<String> {
412+
return if (debug) output else quietCompilerDiagnostics(output)
413+
}
414+
411415
internal fun quietCompilerDiagnostics(output: List<String>): List<String> {
412416
val diagnostics = ArrayList<String>()
413417
var pendingVerboseError: MatchResult? = null

src/test/kotlin/GenerateTests.kt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,25 @@ class GenerateTests {
347347
)
348348
}
349349

350+
@Test(priority = 10)
351+
fun testQuietDebugCompilerFailureOutputBypassesFilter() {
352+
val output = listOf(
353+
"Error Broken.wurst:12: Could not find variable realUserTypo.",
354+
"java.lang.IllegalStateException: extra debug context",
355+
"\tat de.peeeq.wurstio.Main.main(Main.java:1)",
356+
"Warning: Error: e:Could not find variable generatedNoise."
357+
)
358+
359+
Assert.assertEquals(SetupApp.quietCompilerFailureOutput(output, debug = true), output)
360+
Assert.assertEquals(
361+
SetupApp.quietCompilerFailureOutput(output, debug = false),
362+
listOf(
363+
"Error Broken.wurst:12: Could not find variable realUserTypo.",
364+
"java.lang.IllegalStateException: extra debug context"
365+
)
366+
)
367+
}
368+
350369
@Test(priority = 10)
351370
fun testDevBuildFlag() {
352371
val setup = SetupMain()

0 commit comments

Comments
 (0)