Test XML_SetBase() and XML_GetBase() return consistent results
@@ -1450,6 +1450,25 @@ START_TEST(test_set_foreign_dtd)
}
END_TEST
+/* Test XML Base is set and unset appropriately */
+START_TEST(test_set_base)
+{
+ const XML_Char *old_base;
+ const XML_Char *new_base = "/local/file/name.xml";
+
+ old_base = XML_GetBase(parser);
+ if (XML_SetBase(parser, new_base) != XML_STATUS_OK)
+ fail("Unable to set base");
+ if (strcmp(XML_GetBase(parser), new_base) != 0)
+ fail("Base setting not correct");
+ if (XML_SetBase(parser, NULL) != XML_STATUS_OK)
+ fail("Unable to NULL base");
+ if (XML_GetBase(parser) != NULL)
+ fail("Base setting not nulled");
+ XML_SetBase(parser, old_base);
+}
+END_TEST
+
/*
* Namespaces tests.
@@ -2328,6 +2347,7 @@ make_suite(void)
tcase_add_test(tc_basic, test_default_current);
tcase_add_test(tc_basic, test_dtd_elements);
tcase_add_test(tc_basic, test_set_foreign_dtd);
+ tcase_add_test(tc_basic, test_set_base);
suite_add_tcase(s, tc_namespace);
tcase_add_checked_fixture(tc_namespace,
