summaryrefslogtreecommitdiff
path: root/t/unit-tests/strvec.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-12-15 17:54:29 -0800
committerJunio C Hamano <gitster@pobox.com>2024-12-15 17:54:29 -0800
commit67761be92776fec85c9638ba0fc357bc9bc0ac6d (patch)
tree01ab9f734bba55bbb1fa17b7e020c7ca1237ba7c /t/unit-tests/strvec.c
parente6663b9ac58a64bd9712a10e28764f54ac6f9434 (diff)
parent14ef8c04c545d729174839b3ecbad2b5f24b1de6 (diff)
Merge branch 'rj/strvec-splice-fix'
Correct strvec_splice() that misbehaved when the strvec is empty. * rj/strvec-splice-fix: strvec: `strvec_splice()` to a statically initialized vector
Diffstat (limited to 't/unit-tests/strvec.c')
-rw-r--r--t/unit-tests/strvec.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/unit-tests/strvec.c b/t/unit-tests/strvec.c
index 855b602337..e66b7bbfae 100644
--- a/t/unit-tests/strvec.c
+++ b/t/unit-tests/strvec.c
@@ -88,6 +88,16 @@ void test_strvec__pushv(void)
strvec_clear(&vec);
}
+void test_strvec__splice_just_initialized_strvec(void)
+{
+ struct strvec vec = STRVEC_INIT;
+ const char *replacement[] = { "foo" };
+
+ strvec_splice(&vec, 0, 0, replacement, ARRAY_SIZE(replacement));
+ check_strvec(&vec, "foo", NULL);
+ strvec_clear(&vec);
+}
+
void test_strvec__splice_with_same_size_replacement(void)
{
struct strvec vec = STRVEC_INIT;