]> granicus.if.org Git - libexpat/commitdiff
Extend NotStandalone tests to also exclude external entity handlers
authorRhodri James <rhodri@kynesim.co.uk>
Thu, 9 Mar 2017 17:05:50 +0000 (17:05 +0000)
committerSebastian Pipping <sebastian@pipping.org>
Sat, 22 Jul 2017 19:46:16 +0000 (21:46 +0200)
expat/tests/runtests.c

index b45670801a8d9f6546d6634b29ca78d352bd6341..c328c35b559251a2eff27544db907e482fe22ed7 100644 (file)
@@ -1470,6 +1470,12 @@ START_TEST(test_not_standalone_handler_reject)
     XML_SetNotStandaloneHandler(parser, reject_not_standalone_handler);
     expect_failure(text, XML_ERROR_NOT_STANDALONE,
                    "NotStandalone handler failed to reject");
+
+    /* Try again but without external entity handling */
+    XML_ParserReset(parser, NULL);
+    XML_SetNotStandaloneHandler(parser, reject_not_standalone_handler);
+    expect_failure(text, XML_ERROR_NOT_STANDALONE,
+                   "NotStandalone handler failed to reject");
 }
 END_TEST
 
@@ -1496,6 +1502,11 @@ START_TEST(test_not_standalone_handler_accept)
     XML_SetExternalEntityRefHandler(parser, external_entity_loader);
     XML_SetNotStandaloneHandler(parser, accept_not_standalone_handler);
     run_ext_character_check(text, &test_data, "");
+
+    /* Repeat wtihout the external entity handler */
+    XML_ParserReset(parser, NULL);
+    XML_SetNotStandaloneHandler(parser, accept_not_standalone_handler);
+    run_character_check(text, "");
 }
 END_TEST