Skip to content

Commit b4351e8

Browse files
committed
way better mycology test failure output
1 parent ebcfe61 commit b4351e8

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

src/test/java/com/falsepattern/jfunge/storage/TestInterpreter.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,37 @@ public void testMycology() {
8383
val program = readProgram("/mycology.b98");
8484
val returnCode = interpret(new String[]{"mycology.b98"}, program, 300000, nullStream(), output);
8585
val txt = checkingOutput.toString();
86-
Assertions.assertTrue(Arrays.stream(txt.split("\n")).noneMatch((line) -> {
86+
String currentlyActiveFingerprint = null;
87+
boolean fingerprintHadError = false;
88+
boolean good = true;
89+
for (val line: txt.split("\n")) {
90+
if (line.startsWith("Testing fingerprint ")) {
91+
int start = "Testing fingerprint ".length();
92+
currentlyActiveFingerprint = line.substring(start, start + 4);
93+
fingerprintHadError = false;
94+
} else if (line.equals("About to test detailed () behaviour with two fingerprints.")) {
95+
//Fingerprint core checks are over, stop tracking.
96+
currentlyActiveFingerprint = null;
97+
fingerprintHadError = false;
98+
}
8799
if (line.startsWith("BAD")) {
88-
System.err.println("Found BAD check in Mycology! Interpreter is NOT standard-compliant");
89-
return true;
90-
} else {
91-
return false;
100+
if (good) {
101+
System.err.println("Found BAD check(s) in Mycology! Interpreter is NOT standard-compliant.");
102+
good = false;
103+
}
104+
if (currentlyActiveFingerprint != null) {
105+
if (!fingerprintHadError) {
106+
System.err.println("Broken fingerprint: " + currentlyActiveFingerprint);
107+
fingerprintHadError = true;
108+
}
109+
} else {
110+
System.err.println("Not inside a fingerprint test, base language spec is broken. Fix urgently!");
111+
}
112+
System.err.print(" ");
113+
System.err.println(line);
92114
}
93-
}));
115+
}
116+
Assertions.assertTrue(good);
94117
Assertions.assertEquals(15, returnCode);
95118
}
96119

0 commit comments

Comments
 (0)