incorrect usage of C++ std::string caused a test to fail
authorMorgan Deters <mdeters@gmail.com>
Wed, 20 Apr 2011 08:07:07 +0000 (08:07 +0000)
committerMorgan Deters <mdeters@gmail.com>
Wed, 20 Apr 2011 08:07:07 +0000 (08:07 +0000)
test/unit/util/assert_white.h

index 75006ed12698fdb95a9751f15a6bfe80a288ce7e..6a84381362563b4638bca17a33db394b30efd472 100644 (file)
@@ -60,7 +60,8 @@ public:
       // we don't want to match on the entire string, because it may
       // have an absolute path to the unit test binary, line number
       // info, etc.
-      const char* theString = e.toString().c_str();
+      std::string s = e.toString();
+      const char* theString = s.c_str();
       const char* firstPart =
         "Assertion failure\nvoid AssertWhite::testReallyLongAssert()\n";
       string lastPartStr = "\n\n  false\n" + msg;
@@ -84,7 +85,8 @@ public:
       // we don't want to match on the entire string, because it may
       // have an absolute path to the unit test binary, line number
       // info, etc.
-      const char* theString = e.toString().c_str();
+      std::string s = e.toString();
+      const char* theString = s.c_str();
       const char* firstPart =
         "Assertion failure\nvoid AssertWhite::testReallyLongAssert()\n";
       string lastPartStr = "\n\n  false\n" + string(200, 'x') + " " +