summaryrefslogtreecommitdiff
path: root/t/unit-tests/unit-test.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-09-18 18:02:05 -0700
committerJunio C Hamano <gitster@pobox.com>2024-09-18 18:02:05 -0700
commit5d55832f5cf914d583881cdb6f7b76b1793e2b16 (patch)
tree665698b7e6c23568a0f081469c2f990973abbed6 /t/unit-tests/unit-test.h
parent3fb745257b30a643ee78c9a7c52ab107c82e4745 (diff)
parentc3de556a841f132832f742d1c4d3a2618ee3b355 (diff)
Merge branch 'ps/clar-unit-test'
Import clar unit tests framework libgit2 folks invented for our use. * ps/clar-unit-test: Makefile: rename clar-related variables to avoid confusion clar: add CMake support t/unit-tests: convert ctype tests to use clar t/unit-tests: convert strvec tests to use clar t/unit-tests: implement test driver Makefile: wire up the clar unit testing framework Makefile: do not use sparse on third-party sources Makefile: make hdr-check depend on generated headers Makefile: fix sparse dependency on GENERATED_H clar: stop including `shellapi.h` unnecessarily clar(win32): avoid compile error due to unused `fs_copy()` clar: avoid compile error with mingw-w64 t/clar: fix compatibility with NonStop t: import the clar unit testing framework t: do not pass GIT_TEST_OPTS to unit tests with prove
Diffstat (limited to 't/unit-tests/unit-test.h')
-rw-r--r--t/unit-tests/unit-test.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/unit-tests/unit-test.h b/t/unit-tests/unit-test.h
new file mode 100644
index 0000000000..85e5d6a948
--- /dev/null
+++ b/t/unit-tests/unit-test.h
@@ -0,0 +1,10 @@
+#include "git-compat-util.h"
+#include "clar/clar.h"
+#include "clar-decls.h"
+#include "strbuf.h"
+
+#define cl_failf(fmt, ...) do { \
+ char desc[4096]; \
+ snprintf(desc, sizeof(desc), fmt, __VA_ARGS__); \
+ clar__fail(__FILE__, __func__, __LINE__, "Test failed.", desc, 1); \
+} while (0)