1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

Tests: Add regression tests for the LibCpp preprocessor

Similarly to the LibCpp parser regression tests, these tests run the
preprocessor on the .cpp test files under
Userland/LibCpp/Tests/preprocessor, and compare the output with existing
.txt ground truth files.
This commit is contained in:
Itamar 2021-08-13 19:24:16 +03:00 committed by Andreas Kling
parent a38c330c68
commit e57fdb63f8
13 changed files with 101 additions and 3 deletions

View file

@ -0,0 +1,2 @@
#define ADD(x,y) x+y
ADD(2,5);

View file

@ -0,0 +1,4 @@
Integer 1:0-1:2 (2)
Plus 1:0-1:2 (+)
Integer 1:0-1:2 (5)
Semicolon 1:8-1:8 (;)

View file

@ -0,0 +1,3 @@
#define M(x) String {x + "lo"}
M("he" + "l")

View file

@ -0,0 +1,8 @@
KnownType 2:0-2:0 (String)
LeftCurly 2:0-2:0 ({)
DoubleQuotedString 2:0-2:0 ("he")
Plus 2:0-2:0 (+)
DoubleQuotedString 2:0-2:0 ("l")
Plus 2:0-2:0 (+)
DoubleQuotedString 2:0-2:0 ("lo")
RightCurly 2:0-2:0 (})

View file

@ -0,0 +1,4 @@
#define M(x, y, z) x y = z;
M(Vector, vec, ({1,2}))

View file

@ -0,0 +1,11 @@
KnownType 2:0-2:0 (Vector)
Identifier 2:0-2:0 (vec)
Equals 2:0-2:0 (=)
LeftParen 2:0-2:0 (()
LeftCurly 2:0-2:0 ({)
Integer 2:0-2:0 (1)
Comma 2:0-2:0 (,)
Integer 2:0-2:0 (2)
RightCurly 2:0-2:0 (})
RightParen 2:0-2:0 ())
Semicolon 2:0-2:0 (;)

View file

@ -0,0 +1,2 @@
#define NUMBER 1337
int x = NUMBER;

View file

@ -0,0 +1,5 @@
KnownType 1:0-1:2 (int)
Identifier 1:4-1:4 (x)
Equals 1:6-1:6 (=)
Integer 1:8-1:13 (1337)
Semicolon 1:14-1:14 (;)