The test framework now allows you to specify semantic expectations.
An example using direct expectations: The first two parameters specify which AST node is passed as it in the lambda. The last parameter is a short description of the expected state.
'''
if(true)
if(true){}
else{}
'''
.testStatements()
.expect(IfStatement, 1, [it.elseBody === null], "The outer if statement has no else branch")
.expect(IfStatement, 2, [it.elseBody !== null], "The inner if statement has an else branch")
.run();
An example using type and value expectations. The first parameter can specify which ISA's analysis results should be used. In this case we can pass null because there is only one ISA (added by testStatements).
The test framework now allows you to specify semantic expectations.
An example using direct expectations: The first two parameters specify which AST node is passed as
it
in the lambda. The last parameter is a short description of the expected state.An example using type and value expectations. The first parameter can specify which ISA's analysis results should be used. In this case we can pass null because there is only one ISA (added by
testStatements
).