test_end();
}
+static const char *const test_strarray_input[] = {
+ "", "hello", "world", "", "yay", "", NULL
+};
+static struct {
+ const char *separator;
+ const char *output;
+} test_strarray_outputs[] = {
+ { "", "helloworldyay" },
+ /* FIXME: v2.3 - test_output should have separator in the beginning */
+ { " ", "hello world yay " },
+ { "!-?", "hello!-?world!-?!-?yay!-?" }
+};
+
+static void test_t_strarray_join(void)
+{
+ const char *null = NULL;
+ unsigned int i;
+
+ test_begin("t_strarray_join()");
+
+ /* empty array -> empty string */
+ test_assert(strcmp(t_strarray_join(&null, " "), "") == 0);
+
+ for (i = 0; i < N_ELEMENTS(test_strarray_outputs); i++) {
+ test_assert_idx(strcmp(t_strarray_join(test_strarray_input,
+ test_strarray_outputs[i].separator),
+ test_strarray_outputs[i].output) == 0, i);
+ }
+ test_end();
+}
+
void test_strfuncs(void)
{
test_p_strarray_dup();
/*test_t_str_trim();*/
test_t_str_ltrim();
test_t_str_rtrim();
+ test_t_strarray_join();
}