8000 Fixed escape order and expression reporting · log4cplus/Catch@3724463 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3724463

Browse files
committed
Fixed escape order and expression reporting
1 parent 7306eb3 commit 3724463

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

include/reporters/catch_reporter_teamcity.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ namespace Catch {
2323

2424
static std::string escape( std::string const& str ) {
2525
std::string escaped = str;
26+
replaceInPlace( escaped, "|", "||" );
2627
replaceInPlace( escaped, "\'", "|\'" );
2728
replaceInPlace( escaped, "\n", "|n" );
2829
replaceInPlace( escaped, "\r", "|r" );
29-
replaceInPlace( escaped, "|", "||" );
3030
replaceInPlace( escaped, "[", "|[" );
3131
replaceInPlace( escaped, "]", "|]" );
3232
return escaped;
@@ -66,12 +66,13 @@ namespace Catch {
6666
if( !result.isOk() ) {
6767

6868
std::string message;
69+
std::string details;
6970
switch( result.getResultType() ) {
7071
case ResultWas::ExpressionFailed:
7172
message = "expression failed";
7273
break;
7374
case ResultWas::ThrewException:
74-
message = "unexpected exception with message";
75+
message = "unexpected exception";
7576
break;
7677
case ResultWas::FatalErrorCondition:
7778
message = "fatal error condition";
@@ -106,10 +107,12 @@ namespace Catch {
106107
message += "\n" + it->message;
107108

108109

109-
std::string details =
110-
" " + result.getExpressionInMacro() + "\n" +
111-
"with expansion:\n" +
112-
" " + result.getExpandedExpression() + "\n";
110+
if( !result.hasExpression() ) {
111+
details =
112+
" " + result.getExpressionInMacro() + "\n"
113+
"with expansion:\n" +
114+
" " + result.getExpandedExpression() + "\n";
115+
}
113116

114117
// !TBD: file/ line
115118

0 commit comments

Comments
 (0)
0