mirror of
https://github.com/google/benchmark.git
synced 2025-03-27 04:27:12 +08:00
Improve failure mode in complexity_test.cc
This commit is contained in:
parent
1bd62bd0be
commit
440df36e7a
@ -36,18 +36,27 @@ struct TestCase {
|
|||||||
CHECK(err_str.empty()) << "Could not construct regex \"" << regex << "\""
|
CHECK(err_str.empty()) << "Could not construct regex \"" << regex << "\""
|
||||||
<< " got Error: " << err_str;
|
<< " got Error: " << err_str;
|
||||||
|
|
||||||
|
std::string near = "<EOF>";
|
||||||
std::string line;
|
std::string line;
|
||||||
|
bool first = true;
|
||||||
while (remaining_output.eof() == false) {
|
while (remaining_output.eof() == false) {
|
||||||
CHECK(remaining_output.good());
|
CHECK(remaining_output.good());
|
||||||
std::getline(remaining_output, line);
|
std::getline(remaining_output, line);
|
||||||
|
// Keep the first line as context.
|
||||||
|
if (first) {
|
||||||
|
near = line;
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
if (r.Match(line)) return;
|
if (r.Match(line)) return;
|
||||||
CHECK(match_rule != MR_Next) << "Expected line \"" << line
|
CHECK(match_rule != MR_Next) << "Expected line \"" << line
|
||||||
<< "\" to match regex \"" << regex << "\"";
|
<< "\" to match regex \"" << regex << "\""
|
||||||
|
<< "\nstarted matching at line: \"" << near << "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK(remaining_output.eof() == false)
|
CHECK(remaining_output.eof() == false)
|
||||||
<< "End of output reached before match for regex \"" << regex
|
<< "End of output reached before match for regex \"" << regex
|
||||||
<< "\" was found";
|
<< "\" was found"
|
||||||
|
<< "\nstarted matching at line: \"" << near << "\"";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user