Changeset 1fc2958 for tests/check_util.c


Ignore:
Timestamp:
2006-06-16T12:07:51Z (18 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
125b35d
Parents:
c2fa827
Message:

Add checks for nick functions as well, fix bug where nick lengths weren't
being honored.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/check_util.c

    rc2fa827 r1fc2958  
    2525END_TEST
    2626
     27START_TEST(test_strip_newlines)
     28{
     29        int i;
     30        const char *get[] = { "Test", "Test\r\n", "Test\nX\n", NULL };
     31        const char *expected[] = { "Test", "Test  ", "Test X ", NULL };
     32
     33        for (i = 0; get[i]; i++) {
     34                char copy[20], *ret;
     35                strcpy(copy, get[i]);
     36                ret = strip_newlines(copy);
     37                fail_unless (strcmp(copy, expected[i]) == 0,
     38                                         "(%d) strip_newlines broken: %s -> %s (expected: %s)",
     39                                         i, get[i], copy, expected[i]);
     40                fail_unless (copy == ret, "Original string not returned");
     41        }
     42}
     43END_TEST
     44
    2745Suite *util_suite (void)
    2846{
     
    3149        suite_add_tcase (s, tc_core);
    3250        tcase_add_test (tc_core, test_strip_linefeed);
     51        tcase_add_test (tc_core, test_strip_newlines);
    3352        return s;
    3453}
Note: See TracChangeset for help on using the changeset viewer.