Skip to content

Commit

Permalink
chore: Add test for class definition AST
Browse files Browse the repository at this point in the history
  • Loading branch information
robertoraggi committed Aug 20, 2023
1 parent c5b13c8 commit 606acd5
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions tests/unit_tests/ast/class_definition_01.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// RUN: %cxx -verify -ast-dump %s | %filecheck %s --match-full-lines

class EmptyClass {};

class OtherEmptyClass {};

class FinalClass final {};

class DerivedClass : public EmptyClass {};

class DerivedClass2 : public EmptyClass, private OtherEmptyClass {};

class DerivedClass3 : virtual public EmptyClass {};

// clang-format off
// CHECK:translation-unit
// CHECK-NEXT: declaration-list
// CHECK-NEXT: simple-declaration
// CHECK-NEXT: decl-specifier-list
// CHECK-NEXT: class-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: EmptyClass
// CHECK-NEXT: simple-declaration
// CHECK-NEXT: decl-specifier-list
// CHECK-NEXT: class-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: OtherEmptyClass
// CHECK-NEXT: simple-declaration
// CHECK-NEXT: decl-specifier-list
// CHECK-NEXT: class-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: FinalClass
// CHECK-NEXT: simple-declaration
// CHECK-NEXT: decl-specifier-list
// CHECK-NEXT: class-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: DerivedClass
// CHECK-NEXT: base-clause: base-clause
// CHECK-NEXT: base-specifier-list
// CHECK-NEXT: base-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: EmptyClass
// CHECK-NEXT: simple-declaration
// CHECK-NEXT: decl-specifier-list
// CHECK-NEXT: class-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: DerivedClass2
// CHECK-NEXT: base-clause: base-clause
// CHECK-NEXT: base-specifier-list
// CHECK-NEXT: base-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: EmptyClass
// CHECK-NEXT: base-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: OtherEmptyClass
// CHECK-NEXT: simple-declaration
// CHECK-NEXT: decl-specifier-list
// CHECK-NEXT: class-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: DerivedClass3
// CHECK-NEXT: base-clause: base-clause
// CHECK-NEXT: base-specifier-list
// CHECK-NEXT: base-specifier
// CHECK-NEXT: name: simple-name
// CHECK-NEXT: identifier: EmptyClass

0 comments on commit 606acd5

Please sign in to comment.