1669 - now it fails in the right place

..when building until layer 41
This commit is contained in:
Kartik K. Agaram 2015-06-27 18:06:28 -07:00
parent 5877ef3246
commit eba30983f7
2 changed files with 10 additions and 2 deletions

View File

@ -265,9 +265,12 @@ int trace_count(string layer, string line) {
Trace_stream->newline();
long result = 0;
for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) {
if (layer == p->label)
if (line == "" || line == p->contents)
if (layer == p->label) {
//? cerr << "a: " << line << "$\n"; //? 1
//? cerr << "b: " << trim(p->contents) << "$\n"; //? 1
if (line == "" || line == trim(p->contents))
++result;
}
}
return result;
}

View File

@ -51,6 +51,11 @@ void test_trace_supports_count2() {
CHECK_EQ(trace_count("test layer 1"), 2);
}
void test_trace_count_ignores_trailing_whitespace() {
trace("test layer 1") << "foo\n";
CHECK(trace_count("test layer 1", "foo") == 1);
}
// pending: DUMP tests
// pending: readable_contents() adds newline if necessary.
// pending: raise also prints to stderr.