Class ParserTestScenario
java.lang.Object
com.github.tom65536.adelante.parser.ParserTestScenario
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheck(AdelanteParser parser) Check the scenario for a given parser.static List<ParserTestScenario>fromYamlUrl(URL url) Load test scenarios from YAML file.getAst()Get the syntax tree asdertion.Get the name of the production.Get the source being passed to the parser.getTitle()Get the title.toString()
-
Constructor Details
-
ParserTestScenario
public ParserTestScenario()
-
-
Method Details
-
getTitle
Get the title.- Returns:
- the title.
-
getProduction
Get the name of the production.- Returns:
- the name of the production.
-
getSource
Get the source being passed to the parser.- Returns:
- the source code being passed to the parser
-
getAst
Get the syntax tree asdertion.- Returns:
- the syntax tree assertion
-
check
Check the scenario for a given parser.- Parameters:
parser- the parser to be checked.- Throws:
IOException
-
toString
-
fromYamlUrl
Load test scenarios from YAML file.- Parameters:
url- the URL to be read from- Throws:
IOException- if the YAML file cannot be read
-