From: Dmitri Gribenko Date: Mon, 3 Mar 2014 13:21:00 +0000 (+0000) Subject: Decl printing: add tests for typedefs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ea547be7c024d34cf7b8eb6da1016395a6863c1e;p=clang Decl printing: add tests for typedefs Patch by Konrad Kleine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202709 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/unittests/AST/DeclPrinterTest.cpp b/unittests/AST/DeclPrinterTest.cpp index c604fb1e7e..5420d968ce 100644 --- a/unittests/AST/DeclPrinterTest.cpp +++ b/unittests/AST/DeclPrinterTest.cpp @@ -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 class X {};" + "typedef X A;", + "A", + "typedef X 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; }",