diff options
Diffstat (limited to 'unittests/AST/DeclPrinterTest.cpp')
-rw-r--r-- | unittests/AST/DeclPrinterTest.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/unittests/AST/DeclPrinterTest.cpp b/unittests/AST/DeclPrinterTest.cpp index a2fc839b9c8e..44fa74216b59 100644 --- a/unittests/AST/DeclPrinterTest.cpp +++ b/unittests/AST/DeclPrinterTest.cpp @@ -412,8 +412,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl1) { " A();" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A();" + "A()")); } TEST(DeclPrinter, TestCXXConstructorDecl2) { @@ -422,8 +421,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl2) { " A(int a);" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A(int a);" + "A(int a)")); } TEST(DeclPrinter, TestCXXConstructorDecl3) { @@ -432,8 +430,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl3) { " A(const A &a);" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A(const A &a);" + "A(const A &a)")); } TEST(DeclPrinter, TestCXXConstructorDecl4) { @@ -442,8 +439,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl4) { " A(const A &a, int = 0);" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A(const A &a, int = 0);" + "A(const A &a, int = 0)")); } TEST(DeclPrinter, TestCXXConstructorDecl5) { @@ -452,8 +448,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl5) { " A(const A &&a);" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A(const A &&a);" + "A(const A &&a)")); } TEST(DeclPrinter, TestCXXConstructorDecl6) { @@ -462,8 +457,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl6) { " explicit A(int a);" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "explicit A(int a);" + "explicit A(int a)")); } TEST(DeclPrinter, TestCXXConstructorDecl7) { @@ -472,7 +466,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl7) { " constexpr A();" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); + "A()")); // WRONG; Should be: "constexpr A();" } @@ -482,8 +476,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl8) { " A() = default;" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A() = default;" + "A() = default")); } TEST(DeclPrinter, TestCXXConstructorDecl9) { @@ -492,8 +485,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl9) { " A() = delete;" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - " = delete")); - // WRONG; Should be: "A() = delete;" + "A() = delete")); } TEST(DeclPrinter, TestCXXConstructorDecl10) { @@ -503,8 +495,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl10) { " A(const A &a);" "};", constructorDecl(ofClass(hasName("A"))).bind("id"), - "")); - // WRONG; Should be: "A(const A &a);" + "A<T...>(const A<T...> &a)")); } #if !defined(_MSC_VER) @@ -1246,3 +1237,21 @@ TEST(DeclPrinter, TestObjCMethod1) { "- (int) A:(id)anObject inRange:(long)range")); } +TEST(DeclPrinter, TestObjCProtocol1) { + ASSERT_TRUE(PrintedDeclObjCMatches( + "@protocol P1, P2;", + namedDecl(hasName("P1")).bind("id"), + "@protocol P1;\n")); + ASSERT_TRUE(PrintedDeclObjCMatches( + "@protocol P1, P2;", + namedDecl(hasName("P2")).bind("id"), + "@protocol P2;\n")); +} + +TEST(DeclPrinter, TestObjCProtocol2) { + ASSERT_TRUE(PrintedDeclObjCMatches( + "@protocol P2 @end" + "@protocol P1<P2> @end", + namedDecl(hasName("P1")).bind("id"), + "@protocol P1<P2>\n@end")); +} |