Fix headless auto-compare when expected have \r's.

This commit is contained in:
Unknown W. Brackets 2013-10-14 23:54:25 -07:00
parent be47964ff2
commit 5554865ebb

View File

@ -53,7 +53,7 @@ struct BufferedLineReader {
void Fill() {
while (valid_ < MAX_BUFFER && HasMoreLines()) {
buffer_[valid_++] = ReadLine();
buffer_[valid_++] = TrimNewlines(ReadLine());
}
}
@ -128,6 +128,14 @@ protected:
}
}
static std::string TrimNewlines(const std::string &s) {
size_t p = s.find_last_not_of("\r\n");
if (p == s.npos) {
return "";
}
return s.substr(0, p + 1);
}
int valid_;
std::string buffer_[MAX_BUFFER];
const std::string data_;