]> granicus.if.org Git - clang/commitdiff
Disable an assertion death test when using MSVC's assert()
authorReid Kleckner <reid@kleckner.net>
Fri, 21 Jun 2013 12:58:12 +0000 (12:58 +0000)
committerReid Kleckner <reid@kleckner.net>
Fri, 21 Jun 2013 12:58:12 +0000 (12:58 +0000)
MSVC's debug runtime prints assertion failures in wide characters, which
gtest doesn't understand.

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

unittests/ASTMatchers/Dynamic/VariantValueTest.cpp

index 8206d00b81a700047cf61a966f03250e2e0a87fa..c9416728e63bb488a373d2c4a019302b40249845 100644 (file)
@@ -103,7 +103,7 @@ TEST(VariantValueTest, Assignment) {
   EXPECT_EQ("Nothing", Value.getTypeAsString());
 }
 
-TEST(GeneicValueTest, Matcher) {
+TEST(GenericValueTest, Matcher) {
   EXPECT_TRUE(matches("class X {};", VariantValue(recordDecl(hasName("X")))
                                          .getTypedMatcher<Decl>()));
   EXPECT_TRUE(
@@ -112,8 +112,10 @@ TEST(GeneicValueTest, Matcher) {
                       VariantValue(functionDecl()).getTypedMatcher<Decl>()));
   // Can't get the wrong matcher.
   EXPECT_FALSE(VariantValue(varDecl()).hasTypedMatcher<Stmt>());
-#if GTEST_HAS_DEATH_TEST and DEBUG
-  // Trying to get the wrong matcher fails an assertion in Matcher<T>.
+#if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST && !defined(_MSC_VER)
+  // Trying to get the wrong matcher fails an assertion in Matcher<T>.  We don't
+  // do this test when building with MSVC because its debug C runtime prints the
+  // assertion failure message as a wide string, which gtest doesn't understand.
   EXPECT_DEATH(VariantValue(varDecl()).getTypedMatcher<Stmt>(),
                "canConstructFrom");
 #endif