From 5ea34fcc8d11fe82b7652fb51f2143c7502ed73d Mon Sep 17 00:00:00 2001 From: Dmitri Gribenko Date: Mon, 3 Mar 2014 13:21:00 +0000 Subject: [PATCH] Decl printing: add tests for typedefs Patch by Konrad Kleine. llvm-svn: 202709 --- clang/unittests/AST/DeclPrinterTest.cpp | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp index c604fb1e7e3e..5420d968ce27 100644 --- a/clang/unittests/AST/DeclPrinterTest.cpp +++ b/clang/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; }",