From 54803fc30a341281c50bf950d1708b8e8d0789eb Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 4 Aug 2008 09:13:31 +0000 Subject: Make sure we run the last test in the file. Set the scripting enable flag to true, as that's what the testdata assumes. svn path=/trunk/hubbub/; revision=4896 --- test/tree2.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) (limited to 'test/tree2.c') diff --git a/test/tree2.c b/test/tree2.c index 62efb46..6ec0659 100644 --- a/test/tree2.c +++ b/test/tree2.c @@ -155,6 +155,10 @@ static hubbub_parser *setup_parser(void) assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_DOCUMENT_NODE, ¶ms) == HUBBUB_OK); + params.enable_scripting = true; + assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_ENABLE_SCRIPTING, + ¶ms) == HUBBUB_OK); + return parser; } @@ -320,6 +324,16 @@ int main(int argc, char **argv) } if (Document != NULL) { + node_print(&got, Document, 0); + + passed = !strcmp(got.buf, expected.buf); + if (!passed) { + printf("expected:\n"); + printf("%s", expected.buf); + printf("got:\n"); + printf("%s", got.buf); + } + hubbub_parser_destroy(parser); while (Document) { node_t *victim = Document; @@ -813,13 +827,23 @@ static void node_print(buf_t *buf, node_t *node, unsigned depth) buf_add(buf, "data.doctype.name); - if (node->data.doctype.public_id) { - buf_add(buf, " "); - buf_add(buf, node->data.doctype.public_id); - } - if (node->data.doctype.system_id) { - buf_add(buf, " "); - buf_add(buf, node->data.doctype.system_id); + if (node->data.doctype.public_id || + node->data.doctype.system_id) { + if (node->data.doctype.public_id) { + buf_add(buf, " \""); + buf_add(buf, node->data.doctype.public_id); + buf_add(buf, "\" "); + } else { + buf_add(buf, "\"\" "); + } + + if (node->data.doctype.system_id) { + buf_add(buf, " \""); + buf_add(buf, node->data.doctype.system_id); + buf_add(buf, "\""); + } else { + buf_add(buf, "\"\""); + } } buf_add(buf, ">\n"); -- cgit v1.2.3