summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/DeclPrinterTest.cpp
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2014-03-03 13:21:00 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2014-03-03 13:21:00 +0000
commit5ea34fcc8d11fe82b7652fb51f2143c7502ed73d (patch)
treed8270f65917b248ce8b66e20d82e9ca603d2a936 /clang/unittests/AST/DeclPrinterTest.cpp
parent530fb9414bc64a88385b2254a25b15ca4f839887 (diff)
downloadbcm5719-llvm-5ea34fcc8d11fe82b7652fb51f2143c7502ed73d.tar.gz
bcm5719-llvm-5ea34fcc8d11fe82b7652fb51f2143c7502ed73d.zip
Decl printing: add tests for typedefs
Patch by Konrad Kleine. llvm-svn: 202709
Diffstat (limited to 'clang/unittests/AST/DeclPrinterTest.cpp')
-rw-r--r--clang/unittests/AST/DeclPrinterTest.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp
index c604fb1e7e3..5420d968ce2 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 <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; }",
OpenPOWER on IntegriCloud