NEWS: Small section about assert statement

This commit is contained in:
Arne Welzel 2023-06-07 16:40:42 +02:00
parent 0b0f6e509f
commit 30c084d39f

19
NEWS
View file

@ -9,9 +9,28 @@ Zeek 6.1.0
Breaking Changes
----------------
* ``assert`` is now a reserved keyword for the new ``assert`` statement.
New Functionality
-----------------
- Added a new ``assert`` statement for assertion based testing and asserting
runtime state.
assert <expr: bool>[, <message: string>];
This statement comes with two hooks. First, ``assertion_failure()`` that
is invoked for every failing assert statement. Second, ``assertion_result()``
which is invoked for every assert statement and its outcome. The latter allows
to construct a summary of failing and passing assert statements. Both hooks
receive the location and call stack for the ``assert`` statement via a
``Backtrace`` vector.
A failing assert will abort execution of the current event handler similar
to scripting errors. By default, a reporter error message is logged. Using
the break statement within ``assertion_failure()`` or ``assertion_result()``
allows to suppress the default message.
Changed Functionality
---------------------