Record Class ErrorExamples.ExampleUnit

java.lang.Object
java.lang.Record
org.ek9lang.compiler.common.ErrorExamples.ExampleUnit
Record Components:
code - the error code
name - bad, good or good_<suffix>
files - its files: the failing file first (for a failing example), then the others in manifest order, those under dev/ last
Enclosing class:
ErrorExamples

public static record ErrorExamples.ExampleUnit(String code, String name, List<ErrorExamples.ErrorExample> files, List<ErrorExamples.ErrorExample> data, ErrorExamples.ErrorExample capture) extends Record
One example of a code: a single file (bad.ek9, good_open.ek9) or a directory (bad/, good/) whose files compile together as one workspace.
  • Constructor Details

  • Method Details

    • isBad

      public boolean isBad()
      True for the code's failing example.
    • isGood

      public boolean isGood()
      True for one of the code's fixes.
    • isDirectory

      public boolean isDirectory()
      True for a directory example.
    • failing

      public ErrorExamples.ErrorExample failing()
      The file whose @Error directive the failing example is checked by.
      Throws:
      IllegalStateException - when this is a fix, or not exactly one of its files carries a directive
    • companions

      public List<ErrorExamples.ErrorExample> companions()
      The files a failing example's directive file is compiled WITH: its other files.
    • fileNames

      public List<String> fileNames()
      The paths of its files within the code's directory - what a workspace of the code's directory narrows to.
    • runnerArgs

      public Optional<String> runnerArgs()
      The arguments of the ek9 run that demonstrates this example, when it is a test-runner example (ErrorExamples.CLI_RUN); empty for an example the compiler judges.
    • isRunner

      public boolean isRunner()
      True for a test-runner example: the codes ek9 -t reports, shown by a run of the binary.
    • reportedCodes

      public List<String> reportedCodes()
      The codes a failing example reports: its @Error directives, or - for a test-runner example, which has none - the code it is filed under.
    • captureText

      public Optional<String> captureText()
      The golden output of the run, as stored (scrubbed), when this is a test-runner example with one.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • code

      public String code()
      Returns the value of the code record component.
      Returns:
      the value of the code record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • files

      Returns the value of the files record component.
      Returns:
      the value of the files record component
    • data

      Returns the value of the data record component.
      Returns:
      the value of the data record component
    • capture

      public ErrorExamples.ErrorExample capture()
      Returns the value of the capture record component.
      Returns:
      the value of the capture record component