summaryrefslogtreecommitdiffstats
path: root/clang/unittests/AST/DeclPrinterTest.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-06-05 22:40:53 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-06-05 22:40:53 +0000
commit8423df927eb6b24e8821d557c1a26c4cd0f44fcf (patch)
tree7b1e83b3f7c9176bd55444210b78c8d72ef20cb3 /clang/unittests/AST/DeclPrinterTest.cpp
parentb41e76bb0bc6aac90e1755477936b216857b05d6 (diff)
downloadbcm5719-llvm-8423df927eb6b24e8821d557c1a26c4cd0f44fcf.tar.gz
bcm5719-llvm-8423df927eb6b24e8821d557c1a26c4cd0f44fcf.zip
Move a test from static-assert.cpp to DeclPrinterTest
It's better not to rely on the diagnostics engine to pretty print the argument to decltype. Instead, exercise the functionality in DeclPrinterTest. llvm-svn: 239197
Diffstat (limited to 'clang/unittests/AST/DeclPrinterTest.cpp')
-rw-r--r--clang/unittests/AST/DeclPrinterTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp
index 070b4daabb8..d8cb9770922 100644
--- a/clang/unittests/AST/DeclPrinterTest.cpp
+++ b/clang/unittests/AST/DeclPrinterTest.cpp
@@ -157,6 +157,17 @@ public:
"input.cc");
}
+::testing::AssertionResult
+PrintedDeclCXX1ZMatches(StringRef Code, const DeclarationMatcher &NodeMatch,
+ StringRef ExpectedPrinted) {
+ std::vector<std::string> Args(1, "-std=c++1z");
+ return PrintedDeclMatches(Code,
+ Args,
+ NodeMatch,
+ ExpectedPrinted,
+ "input.cc");
+}
+
::testing::AssertionResult PrintedDeclObjCMatches(
StringRef Code,
const DeclarationMatcher &NodeMatch,
@@ -1264,6 +1275,13 @@ TEST(DeclPrinter, TestTemplateArgumentList15) {
// Should be: with semicolon
}
+TEST(DeclPrinter, TestStaticAssert1) {
+ ASSERT_TRUE(PrintedDeclCXX1ZMatches(
+ "static_assert(true);",
+ staticAssertDecl().bind("id"),
+ "static_assert(true)"));
+}
+
TEST(DeclPrinter, TestObjCMethod1) {
ASSERT_TRUE(PrintedDeclObjCMatches(
"__attribute__((objc_root_class)) @interface X\n"
OpenPOWER on IntegriCloud