| 168 | } |
| 169 | |
| 170 | JSONCPP_STRING TestResult::indentText(const JSONCPP_STRING& text, |
| 171 | const JSONCPP_STRING& indent) { |
| 172 | JSONCPP_STRING reindented; |
| 173 | JSONCPP_STRING::size_type lastIndex = 0; |
| 174 | while (lastIndex < text.size()) { |
| 175 | JSONCPP_STRING::size_type nextIndex = text.find('\n', lastIndex); |
| 176 | if (nextIndex == JSONCPP_STRING::npos) { |
| 177 | nextIndex = text.size() - 1; |
| 178 | } |
| 179 | reindented += indent; |
| 180 | reindented += text.substr(lastIndex, nextIndex - lastIndex + 1); |
| 181 | lastIndex = nextIndex + 1; |
| 182 | } |
| 183 | return reindented; |
| 184 | } |
| 185 | |
| 186 | TestResult& TestResult::addToLastFailure(const JSONCPP_STRING& message) { |
| 187 | if (messageTarget_ != nullptr) { |