21 empty_input(
void **state)
32 leading_newline(
void **state)
34 char *s = strdup(
"\nabcd");
41 middle_newline(
void **state)
43 char *s = strdup(
"ab\ncd");
50 trailing_newline(
void **state)
52 char *s = strdup(
"abcd\n\n");
57 s = strdup(
"abcd\n ");
63 other_whitespace(
void **state)
65 char *s = strdup(
" ab\t\ncd \t");
67 assert_string_equal(
pcmk__trim(s),
" ab\t\ncd \t");
71 int main(
int argc,
char **argv) {
72 const struct CMUnitTest tests[] = {
73 cmocka_unit_test(empty_input),
74 cmocka_unit_test(leading_newline),
75 cmocka_unit_test(middle_newline),
76 cmocka_unit_test(trailing_newline),
77 cmocka_unit_test(other_whitespace),
80 cmocka_set_message_output(CM_OUTPUT_TAP);
81 return cmocka_run_group_tests(tests, NULL, NULL);
int main(int argc, char **argv)
char * pcmk__trim(char *str)