From 5cddabdc9c6a230e96d3cb50d8b18235cb57dda7 Mon Sep 17 00:00:00 2001 From: Malcolm Noyes Date: Thu, 23 Jan 2014 10:36:40 +0000 Subject: [PATCH] Add overload to 'print' void* correctly --- include/internal/catch_tostring.hpp | 13 +++++++++++++ scripts/validateVSTests.py | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp index c081e944..3cd339d1 100644 --- a/include/internal/catch_tostring.hpp +++ b/include/internal/catch_tostring.hpp @@ -79,6 +79,19 @@ namespace Detail { } }; + // For display purposes only. + // Anything implicitly convertible to void* ends up here + inline std::string rawMemoryToString(void* p) + { + std::ostringstream oss; +#ifdef _MSC_VER + oss << "0x" << p; +#else + oss << p; +#endif + return oss.str(); + } + // For display purposes only. // Does not consider endian-ness template diff --git a/scripts/validateVSTests.py b/scripts/validateVSTests.py index e1b626e5..1a44a38f 100644 --- a/scripts/validateVSTests.py +++ b/scripts/validateVSTests.py @@ -498,7 +498,9 @@ def approveXml( baseName, args ): f = open( rawResultsPath, 'r' ) for line in f: xml += line + f.close() #xml = xml.replace("", "<hex digits>") + os.remove( rawResultsPath ) otherResultsTestParser = re.compile( r'(.*\\)(.*\..pp)' ) hexParser = re.compile( r'(.*)\b(0[xX][0-9a-fA-F]+)\b(.*)' ) @@ -743,6 +745,8 @@ def approveMsTest( baseName, filter ): if line.startswith("Results file:") or line.startswith("Results File:"): trxFile = line[13:].strip() parseTrxFile(baseName, trxFile) + f.close() + os.remove( rawResultsPath ) # Standard console reporter approve( "console.std", ["~_"] )