From fd2005e680e6baff9538cc1162c1f0a1a82b49e8 Mon Sep 17 00:00:00 2001 From: lchsk Date: Sat, 13 Aug 2016 12:56:40 +0100 Subject: [PATCH] Add test for str_array_strip --- tests/str_array.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/str_array.c b/tests/str_array.c index f6bc8ef..efcce36 100644 --- a/tests/str_array.c +++ b/tests/str_array.c @@ -86,3 +86,19 @@ Test(str_array, several) str_array_free(result); } + +Test(str_array, strip) +{ + char *test = strdup("a: b: c: "); + str_array_t *result = str_array_new(test, ":"); + + str_array_strip(result); + + cr_assert_eq(result->length, 4); + cr_assert_str_eq(result->data[0], "a"); + cr_assert_str_eq(result->data[1], "b"); + cr_assert_str_eq(result->data[2], "c"); + cr_assert_str_eq(result->data[3], ""); + + str_array_free(result); +}