]> granicus.if.org Git - clang/commitdiff
[gtest] The way EXPECT_TEST now works after upgrading gtest triggers an
authorChandler Carruth <chandlerc@gmail.com>
Wed, 4 Jan 2017 23:57:25 +0000 (23:57 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 4 Jan 2017 23:57:25 +0000 (23:57 +0000)
ODR use. These traits don't have a definition as they're intended to be
used strictly at compile time. Change the tests to use static_assert to
move the entire thing into compile-time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291036 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/ASTMatchers/ASTMatchersTraversalTest.cpp

index 67a4a3b2fc097fd27ae96a77c2068e9dc91c0ca0..5957c7fa41dad29737bf32c40e2fd4dc0e227d69 100644 (file)
@@ -222,9 +222,12 @@ TEST(HasDeclaration, HasDeclarationOfEnumType) {
 }
 
 TEST(HasDeclaration, HasGetDeclTraitTest) {
-  EXPECT_TRUE(internal::has_getDecl<TypedefType>::value);
-  EXPECT_TRUE(internal::has_getDecl<RecordType>::value);
-  EXPECT_FALSE(internal::has_getDecl<TemplateSpecializationType>::value);
+  static_assert(internal::has_getDecl<TypedefType>::value,
+                "Expected TypedefType to have a getDecl.");
+  static_assert(internal::has_getDecl<RecordType>::value,
+                "Expected RecordType to have a getDecl.");
+  static_assert(!internal::has_getDecl<TemplateSpecializationType>::value,
+                "Expected TemplateSpecializationType to *not* have a getDecl.");
 }
 
 TEST(HasDeclaration, HasDeclarationOfTypeWithDecl) {