Commit dd6d3008 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

more fixes and extending the tests coverage adding a type init interface

* gentest.py testapi.c: more fixes and extending the tests coverage
* relaxng.c include/libxml/relaxng.h: adding a type init interface
* include/libxml/xmlerror.h parser.c xmlreader.c xmlwriter.c: more
  cleanups and bug fixes raised by the regression tests
Daniel
parent e43cc574
Wed Nov 3 15:19:22 CET 2004 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: more fixes and extending the tests coverage
* relaxng.c include/libxml/relaxng.h: adding a type init interface
* include/libxml/xmlerror.h parser.c xmlreader.c xmlwriter.c: more
cleanups and bug fixes raised by the regression tests
Wed Nov 3 12:49:30 CET 2004 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: more fixes and extending the tests coverage
......
......@@ -15,14 +15,25 @@ except:
#
skipped_modules = [ "SAX", "SAX2", "xlink", "threads", "globals",
"xpathInternals", "xmlunicode", "parserInternals", "xmlmemory",
"xmlversion", "debugXML" ]
"xmlversion", "debugXML", "xmlexports" ]
#
# Some function really need to be skipped for the tests.
#
skipped_functions = [ "xmlFdRead", "xmlReadFd", "xmlCtxtReadFd",
"htmlFdRead", "htmlReadFd", "htmlCtxtReadFd",
"xmlCleanupParser", "xmlStrcat", "xmlStrncat" ]
skipped_functions = [
# block on I/O
"xmlFdRead", "xmlReadFd", "xmlCtxtReadFd",
"htmlFdRead", "htmlReadFd", "htmlCtxtReadFd",
"xmlReaderNewFd",
# library state cleanup, generate false leak informations and other
# troubles, heavillyb tested otherwise.
"xmlCleanupParser", "xmlRelaxNGCleanupTypes",
# hard to avoid leaks in the tests
"xmlStrcat", "xmlStrncat",
# unimplemented
"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml",
"xmlTextReaderReadString"
]
#
# Those functions have side effect on the global state
......@@ -141,6 +152,7 @@ int main(void) {
int blocks, mem;
xmlInitParser();
xmlRelaxNGInitTypes();
LIBXML_TEST_VERSION
......@@ -236,7 +248,7 @@ def type_convert(str, name, info, module, function, pos):
known_param_types = [ "int", "const_char_ptr", "const_xmlChar_ptr",
"xmlParserCtxtPtr", "xmlDocPtr", "filepath", "fileoutput",
"xmlNodePtr", "xmlNodePtr_in", "userdata", "xmlChar_ptr",
"xmlTextWriterPtr" ];
"xmlTextWriterPtr", "xmlTextReaderPtr" ];
def is_known_param_type(name):
for type in known_param_types:
......@@ -379,6 +391,17 @@ static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val)
if (val != NULL) xmlFreeTextWriter(val);
}
#define gen_nb_xmlTextReaderPtr 4
static xmlTextReaderPtr gen_xmlTextReaderPtr(int no) {
if (no == 0) return(xmlNewTextReaderFilename("test/ent2"));
if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml"));
if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd"));
return(NULL);
}
static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val) {
if (val != NULL) xmlFreeTextReader(val);
}
""");
#
......
......@@ -94,6 +94,12 @@ typedef enum {
XML_RELAXNGP_FREE_DOC = 1,
XML_RELAXNGP_CRNG = 2
} xmlRelaxNGParserFlag;
XMLPUBFUN int XMLCALL
xmlRelaxNGInitTypes (void);
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for parsing.
*/
......@@ -153,8 +159,6 @@ XMLPUBFUN void XMLCALL
XMLPUBFUN int XMLCALL
xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt,
xmlDocPtr doc);
XMLPUBFUN void XMLCALL
xmlRelaxNGCleanupTypes (void);
/*
* Interfaces for progressive validation when possible
*/
......
......@@ -58,7 +58,8 @@ typedef enum {
XML_FROM_C14N, /* The Canonicalization module */
XML_FROM_XSLT, /* The XSLT engine from libxslt */
XML_FROM_VALID, /* The XML DTD validation with valid context */
XML_FROM_CHECK /* The error checking module */
XML_FROM_CHECK, /* The error checking module */
XML_FROM_WRITER /* The xmlwriter module */
} xmlErrorDomain;
/**
......
......@@ -12117,6 +12117,7 @@ xmlCleanupParser(void) {
#endif
#ifdef LIBXML_SCHEMAS_ENABLED
xmlSchemaCleanupTypes();
xmlRelaxNGCleanupTypes();
#endif
xmlCleanupGlobals();
xmlResetLastError();
......
......@@ -2781,7 +2781,7 @@ xmlRelaxNGRegisterTypeLibrary(const xmlChar * namespace, void *data,
*
* Returns 0 in case of success and -1 in case of error.
*/
static int
int
xmlRelaxNGInitTypes(void)
{
if (xmlRelaxNGTypeInitialized != 0)
......
This diff is collapsed.
......@@ -1825,7 +1825,7 @@ xmlTextReaderNextSibling(xmlTextReaderPtr reader) {
if (reader == NULL)
return(-1);
if (reader->doc == NULL) {
TODO
/* TODO */
return(-1);
}
......@@ -4629,6 +4629,9 @@ xmlReaderNewWalker(xmlTextReaderPtr reader, xmlDocPtr doc)
if (reader == NULL)
return (-1);
if (reader->input != NULL) {
xmlFreeParserInputBuffer(reader->input);
}
if (reader->ctxt != NULL) {
xmlCtxtReset(reader->ctxt);
}
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment