summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2024-04-10 13:40:16 +0200
committerDaan De Meyer <daan.j.demeyer@gmail.com>2024-04-10 18:24:29 +0200
commit5c041971eb772ec5257e885d52d1788aa04b404a (patch)
treec54502f0e2b362df915dacd21476adcab1d9307a /docs
parentIntroduce ASSERT_OK_ERRNO() (diff)
downloadsystemd-5c041971eb772ec5257e885d52d1788aa04b404a.tar.xz
systemd-5c041971eb772ec5257e885d52d1788aa04b404a.zip
docs: Add Tests section to coding style doc
Diffstat (limited to 'docs')
-rw-r--r--docs/CODING_STYLE.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md
index 6d6e549f5c..7a1977d804 100644
--- a/docs/CODING_STYLE.md
+++ b/docs/CODING_STYLE.md
@@ -780,3 +780,13 @@ SPDX-License-Identifier: LGPL-2.1-or-later
good idea where it might end up running inside of libsystemd.so or
similar. Hence, use TLS (i.e. `thread_local`) where appropriate, and maybe
the occasional `pthread_once()`.
+
+## Tests
+
+- Use the assertion macros from `tests.h` (`ASSERT_GE()`, `ASSERT_OK()`, ...) to
+ make sure a descriptive error is logged when an assertion fails. If no assertion
+ macro exists for your specific use case, please add a new assertion macro in a
+ separate commit.
+
+- When modifying existing tests, please convert the test to use the new assertion
+ macros from `tests.h` if it is not already using those.