need helper functionality for tests to scrap existing log contents
...this is necessary whenever the mocked facility covered by log matching is managed automatically as singleton, because then other test cases will leave garbage in the log
This commit is contained in:
parent
d27d9f79c2
commit
c6945a452e
2 changed files with 48 additions and 0 deletions
|
|
@ -643,6 +643,34 @@ namespace test{
|
|||
}
|
||||
|
||||
|
||||
/** */
|
||||
EventLog&
|
||||
clear()
|
||||
{
|
||||
UNIMPLEMENTED ("clear log contents while retaining just the original Header-ID");
|
||||
}
|
||||
|
||||
/** */
|
||||
EventLog&
|
||||
clear (string alteredLogID)
|
||||
{
|
||||
UNIMPLEMENTED ("clear log contents and reset Header-ID");
|
||||
}
|
||||
|
||||
EventLog&
|
||||
clear (const char* alteredLogID)
|
||||
{
|
||||
return clear (string{alteredLogID});
|
||||
}
|
||||
|
||||
template<class X>
|
||||
EventLog&
|
||||
clear (const X *const obj)
|
||||
{
|
||||
UNIMPLEMENTED ("clear log contents and reset Header-ID");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* ==== Logging API ==== */
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ namespace test{
|
|||
verify_eventLogging();
|
||||
verify_genericLogging();
|
||||
verify_regExpMatch();
|
||||
verify_logPurging();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -351,6 +352,25 @@ namespace test{
|
|||
// argument match must cover all arguments...
|
||||
CHECK (log.ensureNot("spam").argMatch("bacon|^spam"));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
verify_logPurging ()
|
||||
{
|
||||
EventLog log("obnoxious");
|
||||
log.create("spam").create("spam").create("spam");
|
||||
CHECK (log.verify("spam").after("obnoxious"));
|
||||
|
||||
log.clear();
|
||||
CHECK (log.ensureNot("spam"));
|
||||
CHECK (log.verify("obnoxious").type("EventLogHeader").on("obnoxious"));
|
||||
|
||||
log.warn("eggs");
|
||||
log.clear("unbearable");
|
||||
CHECK (log.ensureNot("eggs"));
|
||||
CHECK (log.ensureNot("obnoxious"));
|
||||
CHECK (log.verify("unbearable").type("EventLogHeader").on(&log));
|
||||
}
|
||||
};
|
||||
|
||||
LAUNCHER (TestEventLog_test, "unit common");
|
||||
|
|
|
|||
Loading…
Reference in a new issue