r202709 - Decl printing: add tests for typedefs

Dmitri Gribenko gribozavr at gmail.com
Mon Mar 3 05:21:01 PST 2014


Author: gribozavr
Date: Mon Mar  3 07:21:00 2014
New Revision: 202709

URL: http://llvm.org/viewvc/llvm-project?rev=202709&view=rev
Log:
Decl printing: add tests for typedefs

Patch by Konrad Kleine.

Modified:
    cfe/trunk/unittests/AST/DeclPrinterTest.cpp

Modified: cfe/trunk/unittests/AST/DeclPrinterTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/DeclPrinterTest.cpp?rev=202709&r1=202708&r2=202709&view=diff
==============================================================================
--- cfe/trunk/unittests/AST/DeclPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/DeclPrinterTest.cpp Mon Mar  3 07:21:00 2014
@@ -170,6 +170,40 @@ public:
 
 } // unnamed namespace
 
+TEST(DeclPrinter, TestTypedef1) {
+  ASSERT_TRUE(PrintedDeclCXX98Matches(
+    "typedef int A;",
+    "A",
+    "typedef int A"));
+    // Should be: with semicolon
+}
+
+TEST(DeclPrinter, TestTypedef2) {
+  ASSERT_TRUE(PrintedDeclCXX98Matches(
+    "typedef const char *A;",
+    "A",
+    "typedef const char *A"));
+    // Should be: with semicolon
+}
+
+TEST(DeclPrinter, TestTypedef3) {
+  ASSERT_TRUE(PrintedDeclCXX98Matches(
+    "template <typename Y> class X {};"
+    "typedef X<int> A;",
+    "A",
+    "typedef X<int> A"));
+    // Should be: with semicolon
+}
+
+TEST(DeclPrinter, TestTypedef4) {
+  ASSERT_TRUE(PrintedDeclCXX98Matches(
+    "namespace X { class Y {}; }"
+    "typedef X::Y A;",
+    "A",
+    "typedef X::Y A"));
+    // Should be: with semicolon
+}
+
 TEST(DeclPrinter, TestNamespace1) {
   ASSERT_TRUE(PrintedDeclCXX98Matches(
     "namespace A { int B; }",





More information about the cfe-commits mailing list