Skip to content

Commit bccd532

Browse files
author
Kangmo
committed
Fix unit test error on OSX 10.9 using Apple LLVM v5.0.
Before the fix, there were 6 errors such as : serialize_tests.cpp:77: error in "noncanonical": incorrect exception std::ios_base::failure is caught It turns out that ex.what() returns following string instead of "non-canonical ReadCompactSize()" "non-canonical ReadCompactSize(): unspecified iostream_category error" After the fix, unit test passed. The test ran using Apple LLVM v5.0 on OSX 10.9 and the unit test error happened because of different error messages by different compilers. g++ --version on my development environment. ``` Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) Target: x86_64-apple-darwin13.0.0 Thread model: posix ```
1 parent 8a7606f commit bccd532

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/test/serialize_tests.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,14 @@ BOOST_AUTO_TEST_CASE(compactsize)
6161

6262
static bool isCanonicalException(const std::ios_base::failure& ex)
6363
{
64-
return std::string("non-canonical ReadCompactSize()") == ex.what();
64+
std::string strExplanatoryString("non-canonical ReadCompactSize()");
65+
66+
return strExplanatoryString == ex.what() ||
67+
// OSX Apple LLVM version 5.0 (OSX 10.9)
68+
strExplanatoryString + ": unspecified iostream_category error" == ex.what();
6569
}
6670

71+
6772
BOOST_AUTO_TEST_CASE(noncanonical)
6873
{
6974
// Write some non-canonical CompactSize encodings, and

0 commit comments

Comments
 (0)