aboutsummaryrefslogtreecommitdiffstats
path: root/t/unit-tests/test-lib.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-05-27 13:47:04 +0200
committerJunio C Hamano <gitster@pobox.com>2024-05-27 11:20:02 -0700
commit11ce77b5cc04e2a42b98f0f9f42d367f50f3b1fc (patch)
treede3d223621a5afca4f2d9a24b9d8b280adee2d7c /t/unit-tests/test-lib.c
parent3ef52dd1125b6c9223fd03aca146f6b799e014f9 (diff)
downloadgit-11ce77b5cc04e2a42b98f0f9f42d367f50f3b1fc.tar.gz
strvec: add functions to replace and remove strings
Add two functions that allow to replace and remove strings contained in the strvec. This will be used by a subsequent commit that refactors git-mv(1). While at it, add a bunch of unit tests that cover both old and new functionality. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/test-lib.c')
-rw-r--r--t/unit-tests/test-lib.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/t/unit-tests/test-lib.c b/t/unit-tests/test-lib.c
index 66d6980ffb..3c513ce59a 100644
--- a/t/unit-tests/test-lib.c
+++ b/t/unit-tests/test-lib.c
@@ -318,6 +318,19 @@ int check_bool_loc(const char *loc, const char *check, int ok)
union test__tmp test__tmp[2];
+int check_pointer_eq_loc(const char *loc, const char *check, int ok,
+ const void *a, const void *b)
+{
+ int ret = test_assert(loc, check, ok);
+
+ if (!ret) {
+ test_msg(" left: %p", a);
+ test_msg(" right: %p", b);
+ }
+
+ return ret;
+}
+
int check_int_loc(const char *loc, const char *check, int ok,
intmax_t a, intmax_t b)
{