diff options
author | Andrew Sidwell <andy@entai.co.uk> | 2008-07-10 11:27:17 +0000 |
---|---|---|
committer | Andrew Sidwell <andy@entai.co.uk> | 2008-07-10 11:27:17 +0000 |
commit | 4d85cc91e14c56712824691f1777653ea55bebc9 (patch) | |
tree | e480737b4e7f30c735fcdd096186ca761a1c8ba5 | |
parent | 7ade3c27e7042dc9efda358cbe128137a8cedb71 (diff) | |
download | libhubbub-4d85cc91e14c56712824691f1777653ea55bebc9.tar.gz libhubbub-4d85cc91e14c56712824691f1777653ea55bebc9.tar.bz2 |
Fix another bug in the test harness.
svn path=/trunk/hubbub/; revision=4561
-rw-r--r-- | test/tree2.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/test/tree2.c b/test/tree2.c index 71bd3d7..befef22 100644 --- a/test/tree2.c +++ b/test/tree2.c @@ -192,6 +192,11 @@ static void buf_add(buf_t *buf, const char *str) { size_t len = strlen(str) + 1; + if (!buf) { + printf("%s", str); + return; + } + if (buf->buf == NULL) { buf->len = ((len + 1024) / 1024) * 1024; buf->buf = calloc(1, buf->len); @@ -418,7 +423,15 @@ int append_child(void *ctx, void *parent, void *child, void **result) node_t *insert = NULL; tchild->parent = tparent; - tchild->child = tchild->next = tchild->prev = NULL; + tchild->next = tchild->prev = NULL; + +#ifndef NDEBUG + printf("appending (%x):\n", (unsigned)tchild); + node_print(NULL, tchild, 0); + printf("to:\n"); + if (parent != (void *)1) + node_print(NULL, tparent, 0); +#endif if (parent == (void *)1) { if (Document) { @@ -476,10 +489,11 @@ int remove_child(void *ctx, void *parent, void *child, void **result) node_t *tchild = child; assert(tparent->child); + assert(tchild->parent == tparent); - - if (tchild->parent->child == tchild) + if (tchild->parent->child == tchild) { tchild->parent->child = tchild->next; + } if (tchild->prev) tchild->prev->next = tchild->next; |