Record Class TestDirective

java.lang.Object
java.lang.Record
org.ek9lang.compiler.directives.TestDirective
Record Components:
token - Source location of the directive
group - Optional group name for sequential execution (null = parallel)
lineNumber - The line number the directive applies to (the program declaration line)
All Implemented Interfaces:
Directive

public record TestDirective(IToken token, String group, int lineNumber) extends Record implements Directive
Test directive for marking programs as tests. Used to mark programs as tests for the test runner.
  @Test               - Parallel test (no group)
  @Test: "database"   - Group name for sequential execution within group
  • Constructor Details

    • TestDirective

      public TestDirective(IToken token, String group, int lineNumber)
      Creates an instance of a TestDirective record class.
      Parameters:
      token - the value for the token record component
      group - the value for the group record component
      lineNumber - the value for the lineNumber record component
  • Method Details

    • type

      public DirectiveType type()
      Description copied from interface: Directive
      What s the type of the directive.
      Specified by:
      type in interface Directive
    • isForPhase

      public boolean isForPhase(CompilationPhase phase)
      Description copied from interface: Directive
      Is it for the particular compiler phase.
      Specified by:
      isForPhase in interface Directive
    • getAppliesToLineNumber

      public int getAppliesToLineNumber()
      Description copied from interface: Directive
      Which line number does this directive apply to.
      Specified by:
      getAppliesToLineNumber in interface Directive
    • getDirectiveToken

      public IToken getDirectiveToken()
      Description copied from interface: Directive
      Provide a token from the source, by default if not possible supply synthetic.
      Specified by:
      getDirectiveToken in interface Directive
    • hasGroup

      public boolean hasGroup()
      Check if this test has a group for sequential execution.
    • 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      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.
    • token

      public IToken token()
      Returns the value of the token record component.
      Returns:
      the value of the token record component
    • group

      public String group()
      Returns the value of the group record component.
      Returns:
      the value of the group record component
    • lineNumber

      public int lineNumber()
      Returns the value of the lineNumber record component.
      Returns:
      the value of the lineNumber record component