Class ParserTestScenario

java.lang.Object
com.github.tom65536.adelante.parser.ParserTestScenario

public class ParserTestScenario extends Object
Test scenario for testing the parser. This class provides
  • a title,
  • the name of the relevant production,
  • the source to be passed to the parser, and
  • the expected AST
  • Constructor Details

    • ParserTestScenario

      public ParserTestScenario()
  • Method Details

    • getTitle

      public String getTitle()
      Get the title.
      Returns:
      the title.
    • getProduction

      public String getProduction()
      Get the name of the production.
      Returns:
      the name of the production.
    • getSource

      public String getSource()
      Get the source being passed to the parser.
      Returns:
      the source code being passed to the parser
    • getAst

      public SyntaxTreeAssertion getAst()
      Get the syntax tree asdertion.
      Returns:
      the syntax tree assertion
    • check

      public void check(AdelanteParser parser) throws IOException
      Check the scenario for a given parser.
      Parameters:
      parser - the parser to be checked.
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • fromYamlUrl

      public static List<ParserTestScenario> fromYamlUrl(URL url) throws IOException
      Load test scenarios from YAML file.
      Parameters:
      url - the URL to be read from
      Throws:
      IOException - if the YAML file cannot be read