Class LineByLineComparator
java.lang.Object
org.ek9lang.compiler.support.LineByLineComparator
- All Implemented Interfaces:
BiPredicate<String,
String>
Compares two multi-line strings line-by-lione for equality.
Useful for validating generated output (IR, bytecode) against expected output in directives.
Reports detailed differences including line numbers and content when strings don't match.
-
Constructor Details
-
LineByLineComparator
public LineByLineComparator()
-
-
Method Details
-
test
Compare two multi-line strings line-by-line. Lines are trimmed before comparison to handle whitespace variations. Outputs detailed error information to System.err when differences are found.- Specified by:
test
in interfaceBiPredicate<String,
String> - Parameters:
expected
- The expected stringactual
- The actual string to compare- Returns:
- true if all lines match (after trimming), false otherwise
-