14 | | void ReplaceChar(string& str, char c, string const& replacement) |
15 | | { |
16 | | for (size_t pos = str.find(c); pos != string::npos; pos = str.find(c, pos + 1)) |
17 | | str.replace(pos, 1, replacement); |
| 14 | void ReplaceChar ( string& str, char c, string const& replacement ) { |
| 15 | for ( size_t pos = str.find ( c ); pos != string::npos; pos = str.find ( c, pos + 1 ) ) |
| 16 | str.replace ( pos, 1, replacement ); |
24 | | ReplaceChar(escaped, '&', "&"); |
25 | | ReplaceChar(escaped, '<', "<"); |
26 | | ReplaceChar(escaped, '>', ">"); |
27 | | ReplaceChar(escaped, '\'', "'"); |
28 | | ReplaceChar(escaped, '\"', """); |
29 | | |
30 | | return escaped; |
| 22 | ReplaceChar ( escaped, '&', "&" ); |
| 23 | ReplaceChar ( escaped, '<', "<" ); |
| 24 | ReplaceChar ( escaped, '>', ">" ); |
| 25 | ReplaceChar ( escaped, '\'', "'" ); |
| 26 | ReplaceChar ( escaped, '\"', """ ); |
| 27 | |
| 28 | return escaped; |
33 | | string BuildFailureMessage(string const& file, int line, string const& message) |
34 | | { |
35 | | ostringstream failureMessage; |
36 | | failureMessage << file << "(" << line << ") : " << message; |
37 | | return failureMessage.str(); |
| 31 | string BuildFailureMessage ( string const& file, int line, string const& message ) { |
| 32 | ostringstream failureMessage; |
| 33 | failureMessage << file << "(" << line << ") : " << message; |
| 34 | return failureMessage.str(); |
49 | | void XmlTestReporter::ReportSummary(int totalTestCount, int failedTestCount, |
50 | | int failureCount, float secondsElapsed) |
51 | | { |
52 | | AddXmlElement(m_ostream, NULL); |
| 45 | void XmlTestReporter::ReportSummary ( int totalTestCount, int failedTestCount, |
| 46 | int failureCount, float secondsElapsed ) { |
| 47 | AddXmlElement ( m_ostream, NULL ); |
80 | | void XmlTestReporter::BeginResults(std::ostream& os, int totalTestCount, int failedTestCount, |
81 | | int failureCount, float secondsElapsed) |
82 | | { |
83 | | os << "<unittest-results" |
84 | | << " tests=\"" << totalTestCount << "\"" |
85 | | << " failedtests=\"" << failedTestCount << "\"" |
86 | | << " failures=\"" << failureCount << "\"" |
87 | | << " time=\"" << secondsElapsed << "\"" |
88 | | << ">"; |
| 73 | void XmlTestReporter::BeginResults ( std::ostream& os, int totalTestCount, int failedTestCount, |
| 74 | int failureCount, float secondsElapsed ) { |
| 75 | os << "<unittest-results" |
| 76 | << " tests=\"" << totalTestCount << "\"" |
| 77 | << " failedtests=\"" << failedTestCount << "\"" |
| 78 | << " failures=\"" << failureCount << "\"" |
| 79 | << " time=\"" << secondsElapsed << "\"" |
| 80 | << ">"; |
96 | | void XmlTestReporter::BeginTest(std::ostream& os, DeferredTestResult const& result) |
97 | | { |
98 | | os << "<test" |
99 | | << " suite=\"" << result.suiteName << "\"" |
100 | | << " name=\"" << result.testName << "\"" |
101 | | << " time=\"" << result.timeElapsed << "\""; |
| 87 | void XmlTestReporter::BeginTest ( std::ostream& os, DeferredTestResult const& result ) { |
| 88 | os << "<test" |
| 89 | << " suite=\"" << result.suiteName << "\"" |
| 90 | << " name=\"" << result.testName << "\"" |
| 91 | << " time=\"" << result.timeElapsed << "\""; |
116 | | for (DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); |
117 | | it != result.failures.end(); |
118 | | ++it) |
119 | | { |
120 | | string const escapedMessage = XmlEscape(it->second); |
121 | | string const message = BuildFailureMessage(result.failureFile, it->first, escapedMessage); |
| 104 | for ( DeferredTestResult::FailureVec::const_iterator it = result.failures.begin(); |
| 105 | it != result.failures.end(); |
| 106 | ++it ) { |
| 107 | string const escapedMessage = XmlEscape ( it->second ); |
| 108 | string const message = BuildFailureMessage ( result.failureFile, it->first, escapedMessage ); |