Class LineByLineComparator

java.lang.Object
org.ek9lang.compiler.support.LineByLineComparator
All Implemented Interfaces:
BiPredicate<String,String>

public final class LineByLineComparator extends Object implements 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

      public boolean test(String expected, String actual)
      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 interface BiPredicate<String,String>
      Parameters:
      expected - The expected string
      actual - The actual string to compare
      Returns:
      true if all lines match (after trimming), false otherwise