mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47: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
41
Userland/Libraries/LibCpp/Tests/struct.ast
Normal file
41
Userland/Libraries/LibCpp/Tests/struct.ast
Normal file
|
@ -0,0 +1,41 @@
|
|||
TranslationUnit[1:0->12:0]
|
||||
StructOrClassDeclaration[1:0->7:0]
|
||||
MyStruct
|
||||
MemberDeclaration[3:4->4:4]
|
||||
Type[3:4->3:8]
|
||||
int
|
||||
x
|
||||
MemberDeclaration[4:4->5:0]
|
||||
Pointer[4:12->4:14]
|
||||
Type[4:4->4:12]
|
||||
s
|
||||
next
|
||||
FunctionDeclaration[7:0->12:0]
|
||||
Type[7:0->7:4]
|
||||
int
|
||||
foo
|
||||
(
|
||||
)
|
||||
FunctionDefinition[8:0->12:0]
|
||||
{
|
||||
VariableDeclaration[9:4->9:14]
|
||||
Type[9:4->9:13]
|
||||
MyStruct
|
||||
s
|
||||
FunctionCall[10:4->10:23]
|
||||
Name[10:4->10:10]
|
||||
printf
|
||||
StringLiteral[10:11->10:16]
|
||||
"%d\n"
|
||||
MemberExpression[10:19->10:22]
|
||||
Name[10:19->10:20]
|
||||
s
|
||||
Identifier[10:21->10:21]
|
||||
x
|
||||
ReturnStatement[11:4->11:14]
|
||||
MemberExpression[11:11->11:14]
|
||||
Name[11:11->11:12]
|
||||
s
|
||||
Identifier[11:13->11:13]
|
||||
x
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue