EventLog: split into header and dedicated translation unit (WIP)
This commit is contained in:
parent
9e96effcf1
commit
1df5bf5c5e
3 changed files with 1071 additions and 3 deletions
1038
src/lib/test/event-log.cpp
Normal file
1038
src/lib/test/event-log.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -27,9 +27,39 @@
|
|||
** the [EventLog] allows to record invocations and similar events. It is
|
||||
** implemented as a "PImpl" to allow sharing of logs, which helps to trace
|
||||
** events from transient UI elements and from destructor code. The front-end
|
||||
** used for access offers a query facility, so the test code may express some
|
||||
** used for access offers a query DSL, so the test code may express some
|
||||
** expected patterns of incidence and verify match or non-match.
|
||||
**
|
||||
** # Usage
|
||||
**
|
||||
** The EventLog just captures invocations in memory, as sequence of
|
||||
** [string records](\ref lib::diff::Record). The _logging API_ offers some
|
||||
** dedicated functions to record invocations, events, the creation and destruction
|
||||
** of objects, warnings and error messages. Data passed to those logging functions
|
||||
** is rendered into string, using Lumiera's generic string conversion helpers.
|
||||
**
|
||||
** To _verify and match_ on log contents, start an evaluation as a builder (DSL)
|
||||
** expression, starting from one of the #verify functions, or starting with #ensureNot,
|
||||
** to probe that a given set of matches does not occur in the log. These entrance
|
||||
** functions set up the initial search condition, and further search conditions
|
||||
** can be chained up by invoking suitable matching functions on the generated
|
||||
** EventMatch builder. Most notably, it is possible to search for some further
|
||||
** match condition _before_ or _after_ the position where the preceding condition
|
||||
** produced a match -- allowing to specify sequences and patterns of events to
|
||||
** expect in the log
|
||||
** \code{.cpp}
|
||||
** EventLog log("baked beans");
|
||||
** log.event("spam");
|
||||
** log.event("ham");
|
||||
**
|
||||
** CHECK (log.verify("ham")
|
||||
** .after("beans")
|
||||
** .before("spam")
|
||||
** .before("ham"));
|
||||
** \endcode
|
||||
** In general, this kind of search with a switch of the search direction in the middle
|
||||
** of a match requires some backtracking to try possible matches until exhaustion.
|
||||
**
|
||||
** Failure of match prints a detailed trace message to `STDERR`, in order
|
||||
** to deliver a precise indication what part of the condition failed.
|
||||
** @note this sequence prints the matches succeeding _at the point_ where each
|
||||
|
|
|
|||
|
|
@ -31978,8 +31978,8 @@
|
|||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537059994048" ID="ID_1556879726" MODIFIED="1537400219755" TEXT="Umbau">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537060007341" ID="ID_137118669" MODIFIED="1537060024165" TEXT="eigene Translation-Unit EventLog.cpp anlegen">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
<node COLOR="#338800" CREATED="1537060007341" ID="ID_137118669" MODIFIED="1537402606149" TEXT="eigene Translation-Unit EventLog.cpp anlegen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1537060024891" ID="ID_416527676" MODIFIED="1537060038043" TEXT="Ctor nach hinten schieben">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue