Skip to content

Commit ca53c8f

Browse files
authored
Print test names and test group names escaped when using teamcity
When using Teamcity output, we encountered ill formatted output due to missing escapes in testnames. This Patch always outputs "user defined messages" escaped
1 parent dd81514 commit ca53c8f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/CppUTest/TeamCityTestOutput.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ TeamCityTestOutput::~TeamCityTestOutput()
1212
void TeamCityTestOutput::printCurrentTestStarted(const UtestShell& test)
1313
{
1414
print("##teamcity[testStarted name='");
15-
print(test.getName().asCharString());
15+
printEscaped(test.getName().asCharString());
1616
print("']\n");
1717
if (!test.willRun()) {
1818
print("##teamcity[testIgnored name='");
19-
print(test.getName().asCharString());
19+
printEscaped(test.getName().asCharString());
2020
print("']\n");
2121
}
2222
currtest_ = &test;
@@ -28,7 +28,7 @@ void TeamCityTestOutput::printCurrentTestEnded(const TestResult& res)
2828
return;
2929

3030
print("##teamcity[testFinished name='");
31-
print(currtest_->getName().asCharString());
31+
printEscaped(currtest_->getName().asCharString());
3232
print("' duration='");
3333
print(res.getCurrentTestTotalExecutionTime());
3434
print("']\n");
@@ -38,7 +38,7 @@ void TeamCityTestOutput::printCurrentGroupStarted(const UtestShell& test)
3838
{
3939
currGroup_ = test.getGroup();
4040
print("##teamcity[testSuiteStarted name='");
41-
print(currGroup_.asCharString());
41+
printEscaped(currGroup_.asCharString());
4242
print("']\n");
4343
}
4444

@@ -48,7 +48,7 @@ void TeamCityTestOutput::printCurrentGroupEnded(const TestResult& /*res*/)
4848
return;
4949

5050
print("##teamcity[testSuiteFinished name='");
51-
print(currGroup_.asCharString());
51+
printEscaped(currGroup_.asCharString());
5252
print("']\n");
5353
}
5454

@@ -80,17 +80,17 @@ void TeamCityTestOutput::printEscaped(const char* s)
8080
void TeamCityTestOutput::printFailure(const TestFailure& failure)
8181
{
8282
print("##teamcity[testFailed name='");
83-
print(failure.getTestNameOnly().asCharString());
83+
printEscaped(failure.getTestNameOnly().asCharString());
8484
print("' message='");
8585
if (failure.isOutsideTestFile() || failure.isInHelperFunction()) {
8686
print("TEST failed (");
87-
print(failure.getTestFileName().asCharString());
87+
printEscaped(failure.getTestFileName().asCharString());
8888
print(":");
8989
print(failure.getTestLineNumber());
9090
print("): ");
9191
}
9292

93-
print(failure.getFileName().asCharString());
93+
printEscaped(failure.getFileName().asCharString());
9494
print(":");
9595
print(failure.getFailureLineNumber());
9696

0 commit comments

Comments
 (0)