mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:17:35 +00:00
LibCpp: Add regression tests for the parser
For each .cpp file in the test suite data, there is a .ast file that represents the "known good" baseline of the parser result. Each .cpp file goes through the parser, and the result of invoking `ASTNode::dump()` on the root node is compared to the baseline to find regressions. We also check that there were no parser errors when parsing the .cpp files.
This commit is contained in:
parent
fbf796cd9f
commit
832e9c6e02
16 changed files with 1264 additions and 3 deletions
33
Userland/Libraries/LibCpp/Tests/if-else.ast
Normal file
33
Userland/Libraries/LibCpp/Tests/if-else.ast
Normal file
|
@ -0,0 +1,33 @@
|
|||
TranslationUnit[0:0->7:0]
|
||||
FunctionDeclaration[0:0->7:0]
|
||||
Type[0:0->0:4]
|
||||
int
|
||||
foo
|
||||
(
|
||||
)
|
||||
FunctionDefinition[1:0->7:0]
|
||||
{
|
||||
IfStatement[2:4->3:16]
|
||||
Predicate:
|
||||
NumericLiteral[2:8->2:8]
|
||||
2
|
||||
Then:
|
||||
ReturnStatement[3:8->3:16]
|
||||
NumericLiteral[3:15->3:15]
|
||||
2
|
||||
IfStatement[4:4->5:16]
|
||||
Predicate:
|
||||
BinaryExpression[4:8->4:12]
|
||||
NumericLiteral[4:8->4:8]
|
||||
1
|
||||
<
|
||||
NumericLiteral[4:12->4:12]
|
||||
2
|
||||
Then:
|
||||
ReturnStatement[5:8->5:16]
|
||||
NumericLiteral[5:15->5:15]
|
||||
1
|
||||
ReturnStatement[6:4->6:12]
|
||||
NumericLiteral[6:11->6:11]
|
||||
0
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue