From 610b380515624013e42b7ba3a73e7e15440d1d5c Mon Sep 17 00:00:00 2001 From: Itamar Date: Tue, 22 Feb 2022 20:17:43 +0200 Subject: [PATCH] Libraries/LibCpp: Add parser test for out-of-line function definitions --- .../LibCpp/Tests/parser/out-of-line.ast | 21 +++++++++++++++++++ .../LibCpp/Tests/parser/out-of-line.cpp | 10 +++++++++ 2 files changed, 31 insertions(+) create mode 100644 Userland/Libraries/LibCpp/Tests/parser/out-of-line.ast create mode 100644 Userland/Libraries/LibCpp/Tests/parser/out-of-line.cpp diff --git a/Userland/Libraries/LibCpp/Tests/parser/out-of-line.ast b/Userland/Libraries/LibCpp/Tests/parser/out-of-line.ast new file mode 100644 index 0000000000..08119aad33 --- /dev/null +++ b/Userland/Libraries/LibCpp/Tests/parser/out-of-line.ast @@ -0,0 +1,21 @@ +TranslationUnit[2:0->9:0] + StructOrClassDeclaration[2:6->7:0] + A + FunctionDeclaration[4:4->4:14] + NamedType[4:4->4:7] + bool + foo + ( + ) + FunctionDeclaration[7:0->9:0] + NamedType[7:0->7:3] + bool + A::foo + ( + ) + FunctionDefinition[7:14->9:0] + { + ReturnStatement[8:4->8:15] + BooleanLiteral[8:11->8:14] + true + } diff --git a/Userland/Libraries/LibCpp/Tests/parser/out-of-line.cpp b/Userland/Libraries/LibCpp/Tests/parser/out-of-line.cpp new file mode 100644 index 0000000000..8be70f1b12 --- /dev/null +++ b/Userland/Libraries/LibCpp/Tests/parser/out-of-line.cpp @@ -0,0 +1,10 @@ + + +class A +{ + bool foo(); +}; + +bool A::foo() { + return true; +}