forked from github/server
leak: free strlist result of split_paragraph
This commit is contained in:
parent
24f1f82e93
commit
f4f038c23c
1 changed files with 7 additions and 0 deletions
|
@ -145,18 +145,25 @@ static void test_write_many_spaces(CuTest *tc) {
|
||||||
|
|
||||||
static void test_sparagraph(CuTest *tc) {
|
static void test_sparagraph(CuTest *tc) {
|
||||||
strlist *sp = 0;
|
strlist *sp = 0;
|
||||||
|
|
||||||
split_paragraph(&sp, "Hello World", 0, 16, 0);
|
split_paragraph(&sp, "Hello World", 0, 16, 0);
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, "Hello World", sp->s);
|
CuAssertStrEquals(tc, "Hello World", sp->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next);
|
CuAssertPtrEquals(tc, 0, sp->next);
|
||||||
|
freestrlist(sp);
|
||||||
|
|
||||||
split_paragraph(&sp, "Hello World", 4, 16, 0);
|
split_paragraph(&sp, "Hello World", 4, 16, 0);
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, " Hello World", sp->s);
|
CuAssertStrEquals(tc, " Hello World", sp->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next);
|
CuAssertPtrEquals(tc, 0, sp->next);
|
||||||
|
freestrlist(sp);
|
||||||
|
|
||||||
split_paragraph(&sp, "Hello World", 4, 16, '*');
|
split_paragraph(&sp, "Hello World", 4, 16, '*');
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, " * Hello World", sp->s);
|
CuAssertStrEquals(tc, " * Hello World", sp->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next);
|
CuAssertPtrEquals(tc, 0, sp->next);
|
||||||
|
freestrlist(sp);
|
||||||
|
|
||||||
split_paragraph(&sp, "12345678 90 12345678", 0, 8, '*');
|
split_paragraph(&sp, "12345678 90 12345678", 0, 8, '*');
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, "12345678", sp->s);
|
CuAssertStrEquals(tc, "12345678", sp->s);
|
||||||
|
|
Loading…
Reference in a new issue