Remove ansi codes.

This commit is contained in:
Stephan Schnabel 2025-02-12 13:51:07 +01:00
parent 22b95f995a
commit 4737fd32db
Signed by: stephan.schnabel
GPG key ID: E07AF5BA239FE543
2 changed files with 4 additions and 2 deletions

View file

@ -7,12 +7,13 @@ for (String log : logs) {
if (!log.contains("test-output-marker")) { if (!log.contains("test-output-marker")) {
continue; continue;
} }
if (java.util.regex.Pattern.matches(expected, log)) { if (java.util.regex.Pattern.matches(expected, log.replaceAll("\u001B\\[[;\\d]*m", ""))) {
return true; return true;
} else { } else {
System.out.println("marker found, but formatting invalid:"); System.out.println("marker found, but formatting invalid:");
System.out.println("[EXPECTED] " + expected); System.out.println("[EXPECTED] " + expected);
System.out.println("[ACTUAL] " + log); System.out.println("[ACTUAL] " + log);
System.out.println("[BASE64] " + Base64.getEncoder().encodeToString(log.getBytes()));
return false; return false;
} }
} }

View file

@ -7,12 +7,13 @@ for (String log : logs) {
if (!log.contains("test-output-marker")) { if (!log.contains("test-output-marker")) {
continue; continue;
} }
if (java.util.regex.Pattern.matches(expected, log)) { if (java.util.regex.Pattern.matches(expected, log.replaceAll("\u001B\\[[;\\d]*m", ""))) {
return true; return true;
} else { } else {
System.out.println("marker found, but formatting invalid:"); System.out.println("marker found, but formatting invalid:");
System.out.println("[EXPECTED] " + expected); System.out.println("[EXPECTED] " + expected);
System.out.println("[ACTUAL] " + log); System.out.println("[ACTUAL] " + log);
System.out.println("[BASE64] " + Base64.getEncoder().encodeToString(log.getBytes()));
return false; return false;
} }
} }