summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-08-04 09:13:31 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-08-04 09:13:31 +0000
commit54803fc30a341281c50bf950d1708b8e8d0789eb (patch)
treeef1b9c49188583d1a935a6fa8e928e0f8644d805
parentc7b80c552670814c23cefbc69b699579f8303c27 (diff)
downloadlibhubbub-54803fc30a341281c50bf950d1708b8e8d0789eb.tar.gz
libhubbub-54803fc30a341281c50bf950d1708b8e8d0789eb.tar.bz2
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
-rw-r--r--test/tree2.c38
1 files changed, 31 insertions, 7 deletions
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,
&params) == HUBBUB_OK);
+ params.enable_scripting = true;
+ assert(hubbub_parser_setopt(parser, HUBBUB_PARSER_ENABLE_SCRIPTING,
+ &params) == 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, "<!DOCTYPE ");
buf_add(buf, node->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");