Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Fixed escape order and expression reporting

Commit
3724463be71405378ce6b813f44961709138911c
Author
Phil Nash ·
Parents
7306eb3cfcf3

Files · Download .tar.gz

Changes

 include/reporters/catch_reporter_teamcity.hpp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/include/reporters/catch_reporter_teamcity.hpp b/include/reporters/catch_reporter_teamcity.hpp
index 16215e7a..30cda566 100644
--- a/include/reporters/catch_reporter_teamcity.hpp
+++ b/include/reporters/catch_reporter_teamcity.hpp
@@ -23,10 +23,10 @@ namespace Catch {
         
         static std::string escape( std::string const& str ) {
             std::string escaped = str;
+            replaceInPlace( escaped, "|", "||" );
             replaceInPlace( escaped, "\'", "|\'" );
             replaceInPlace( escaped, "\n", "|n" );
             replaceInPlace( escaped, "\r", "|r" );
-            replaceInPlace( escaped, "|", "||" );
             replaceInPlace( escaped, "[", "|[" );
             replaceInPlace( escaped, "]", "|]" );
             return escaped;
@@ -66,12 +66,13 @@ namespace Catch {
             if( !result.isOk() ) {
                 
                 std::string message;
+                std::string details;
                 switch( result.getResultType() ) {
                     case ResultWas::ExpressionFailed:
                         message = "expression failed";
                         break;
                     case ResultWas::ThrewException:
-                        message = "unexpected exception with message";
+                        message = "unexpected exception";
                         break;
                     case ResultWas::FatalErrorCondition:
                         message = "fatal error condition";
@@ -106,10 +107,12 @@ namespace Catch {
                     message += "\n" + it->message;
                 
                 
-                std::string details =
-                    "  " + result.getExpressionInMacro() + "\n" +
-                    "with expansion:\n" +
-                    "  " + result.getExpandedExpression() + "\n";
+                if( !result.hasExpression() ) {
+                    details =
+                        "  " + result.getExpressionInMacro() + "\n"
+                        "with expansion:\n" +
+                        "  " + result.getExpandedExpression() + "\n";
+                }
                 
                 // !TBD: file/ line