| 180 | } |
| 181 | |
| 182 | JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text, |
| 183 | const JSONCPP_STRING& indent) { |
| 184 | JSONCPP_STRING reindented; |
| 185 | JSONCPP_STRING::size_type lastIndex = 0; |
| 186 | while (lastIndex < text.size()) { |
| 187 | JSONCPP_STRING::size_type nextIndex = text.find('\n', lastIndex); |
| 188 | if (nextIndex == JSONCPP_STRING::npos) { |
| 189 | nextIndex = text.size() - 1; |
| 190 | } |
| 191 | reindented += indent; |
| 192 | reindented += text.substr(lastIndex, nextIndex - lastIndex + 1); |
| 193 | lastIndex = nextIndex + 1; |
| 194 | } |
| 195 | return reindented; |
| 196 | } |
| 197 | |
| 198 | TestResult& TestResult::addToLastFailure(const JSONCPP_STRING& message) { |
| 199 | if (messageTarget_ != 0) { |