mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Fix assertionStarting events being sent after the expr is evaluated
Closes #2678
This commit is contained in:
@@ -96,12 +96,12 @@ void assertionStarting( AssertionInfo const& assertionInfo );
|
||||
void assertionEnded( AssertionStats const& assertionStats );
|
||||
```
|
||||
|
||||
`assertionStarting` is called after the expression is captured, but before
|
||||
the assertion expression is evaluated. This might seem like a minor
|
||||
distinction, but what it means is that if you have assertion like
|
||||
`REQUIRE( a + b == c + d )`, then what happens is that `a + b` and `c + d`
|
||||
are evaluated before `assertionStarting` is emitted, while the `==` is
|
||||
evaluated after the event.
|
||||
The `assertionStarting` event is emitted before the expression in the
|
||||
assertion is captured or evaluated and `assertionEnded` is emitted
|
||||
afterwards. This means that given assertion like `REQUIRE(a + b == c + d)`,
|
||||
Catch2 first emits `assertionStarting` event, then `a + b` and `c + d`
|
||||
are evaluated, then their results are captured, the comparison is evaluated,
|
||||
and then `assertionEnded` event is emitted.
|
||||
|
||||
|
||||
## Benchmarking events
|
||||
|
Reference in New Issue
Block a user