diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-26 20:20:03 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-09-26 20:20:57 -0400 |
commit | 7e7cfe8acdc8e506a5e670e7cfb74e43c031ccaf (patch) | |
tree | fedcb7be8c2b7c200e2fdbe5f9219ca8f567d649 /tests/core/buffer.c | |
parent | 136901086ecfdd2b5cc106782310355a9c0b1a9a (diff) | |
download | libgit2-ethomson/strarray.tar.gz |
buf: common_prefix takes a string arrayethomson/strarray
`git_strarray` is a public-facing type. Change
`git_buf_text_common_prefix` to not use it, and just take an array of
strings instead.
Diffstat (limited to 'tests/core/buffer.c')
-rw-r--r-- | tests/core/buffer.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/tests/core/buffer.c b/tests/core/buffer.c index 22fa75e39..2af4a8712 100644 --- a/tests/core/buffer.c +++ b/tests/core/buffer.c @@ -632,7 +632,6 @@ void test_core_buffer__join3(void) void test_core_buffer__11(void) { git_buf a = GIT_BUF_INIT; - git_strarray t; char *t1[] = { "nothing", "in", "common" }; char *t2[] = { "something", "something else", "some other" }; char *t3[] = { "something", "some fun", "no fun" }; @@ -641,39 +640,25 @@ void test_core_buffer__11(void) char *t6[] = { "no", "nope", "" }; char *t7[] = { "", "doesn't matter" }; - t.strings = t1; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t1, 3)); cl_assert_equal_s(a.ptr, ""); - t.strings = t2; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t2, 3)); cl_assert_equal_s(a.ptr, "some"); - t.strings = t3; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t3, 3)); cl_assert_equal_s(a.ptr, ""); - t.strings = t4; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t4, 3)); cl_assert_equal_s(a.ptr, "happ"); - t.strings = t5; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t5, 3)); cl_assert_equal_s(a.ptr, "happ"); - t.strings = t6; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t6, 3)); cl_assert_equal_s(a.ptr, ""); - t.strings = t7; - t.count = 3; - cl_git_pass(git_buf_common_prefix(&a, &t)); + cl_git_pass(git_buf_common_prefix(&a, t7, 3)); cl_assert_equal_s(a.ptr, ""); git_buf_dispose(&a); |