summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp/Tests/if-else.cpp
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-05-17 11:06:30 +0300
committerAndreas Kling <kling@serenityos.org>2021-05-19 23:19:07 +0200
commit832e9c6e02b3629db8d5303fb94ec9d0e7a7b145 (patch)
treefeba63a26148ac8d52813e395dfa7b6ddba61392 /Userland/Libraries/LibCpp/Tests/if-else.cpp
parentfbf796cd9f8934b3cdcdbb398dc78b61a6e830c1 (diff)
downloadserenity-832e9c6e02b3629db8d5303fb94ec9d0e7a7b145.zip
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.
Diffstat (limited to 'Userland/Libraries/LibCpp/Tests/if-else.cpp')
-rw-r--r--Userland/Libraries/LibCpp/Tests/if-else.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Tests/if-else.cpp b/Userland/Libraries/LibCpp/Tests/if-else.cpp
new file mode 100644
index 0000000000..91d0fe62fe
--- /dev/null
+++ b/Userland/Libraries/LibCpp/Tests/if-else.cpp
@@ -0,0 +1,8 @@
+int foo()
+{
+ if (2)
+ return 2;
+ if (1 < 2)
+ return 1;
+ return 0;
+}