]> granicus.if.org Git - libexpat/commitdiff
Ensure unparsed entity handler gets set
authorRhodri James <rhodri@kynesim.co.uk>
Mon, 6 Feb 2017 16:35:04 +0000 (16:35 +0000)
committerSebastian Pipping <sebastian@pipping.org>
Sun, 5 Mar 2017 21:05:54 +0000 (22:05 +0100)
This adds test coverage for an obsolete handler that is supported
only for backwards compatibility.  While it is supported, we should
test it.

expat/tests/runtests.c

index a5e30ee76933dd142c254d98fc0b648c55cb2857..9c175eea5d3506aa7e40a3287cff7f973edf1a9d 100644 (file)
@@ -182,6 +182,18 @@ static void XMLCALL
 dummy_end_cdata_handler(void *UNUSED_P(userData))
 {}
 
+/* This handler is obsolete, but while the code exists we should
+ * ensure that dealing with the handler is covered by tests.
+ */
+static void XMLCALL
+dummy_unparsed_entity_decl_handler(void *UNUSED_P(userData),
+                                   const XML_Char *UNUSED_P(entityName),
+                                   const XML_Char *UNUSED_P(base),
+                                   const XML_Char *UNUSED_P(systemId),
+                                   const XML_Char *UNUSED_P(publicId),
+                                   const XML_Char *UNUSED_P(notationName))
+{}
+
 
 /*
  * Character & encoding tests.
@@ -2662,6 +2674,9 @@ START_TEST(test_alloc_dtd_default_handling)
         XML_SetCdataSectionHandler(parser,
                                    dummy_start_cdata_handler,
                                    dummy_end_cdata_handler);
+        XML_SetUnparsedEntityDeclHandler(
+            parser,
+            dummy_unparsed_entity_decl_handler);
         CharData_Init(&storage);
         XML_SetUserData(parser, &storage);
         XML_SetCharacterDataHandler(parser, accumulate_characters);