summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2021-06-08 23:04:19 +0300
committerAndreas Kling <kling@serenityos.org>2021-06-09 22:26:46 +0200
commitee9fe288b2d9182e83185b07a925df095289ddb2 (patch)
tree8100d2810f9745cc5385eca7a050cca5c4e62085 /Userland/Libraries
parent7de6c1489b9ef0eedda522b5873026375b1df872 (diff)
downloadserenity-ee9fe288b2d9182e83185b07a925df095289ddb2.zip
LibCpp: Add test for parsing class definitions
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibCpp/Tests/class.ast27
-rw-r--r--Userland/Libraries/LibCpp/Tests/class.cpp11
2 files changed, 38 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCpp/Tests/class.ast b/Userland/Libraries/LibCpp/Tests/class.ast
new file mode 100644
index 0000000000..30160bb4a8
--- /dev/null
+++ b/Userland/Libraries/LibCpp/Tests/class.ast
@@ -0,0 +1,27 @@
+TranslationUnit[0:0->10:1]
+ StructOrClassDeclaration[0:6->10:1]
+ A
+ C'tor
+ (
+ Parameter[1:6->1:10]
+ z
+ Type[1:6->1:10]
+ int
+ )
+ D'tor
+ (
+ )
+ FunctionDeclaration[3:4->3:14]
+ Type[3:4->3:9]
+ void
+ foo
+ (
+ )
+ VariableDeclaration[6:4->8:0]
+ Type[6:4->6:8]
+ int
+ x
+ VariableDeclaration[9:4->10:0]
+ Type[9:4->9:8]
+ int
+ y
diff --git a/Userland/Libraries/LibCpp/Tests/class.cpp b/Userland/Libraries/LibCpp/Tests/class.cpp
new file mode 100644
index 0000000000..4ba773a943
--- /dev/null
+++ b/Userland/Libraries/LibCpp/Tests/class.cpp
@@ -0,0 +1,11 @@
+class A {
+ A(int z);
+ ~A();
+ void foo();
+
+private:
+ int x;
+
+public:
+ int y;
+};