| 172 | ************************************************************************/ |
| 173 | |
| 174 | static int |
| 175 | xmlconfTestInvalid(const char *id, const char *filename, int options) { |
| 176 | xmlDocPtr doc; |
| 177 | xmlParserCtxtPtr ctxt; |
| 178 | int ret = 1; |
| 179 | |
| 180 | ctxt = xmlNewParserCtxt(); |
| 181 | if (ctxt == NULL) { |
| 182 | test_log("test %s : %s out of memory\n", |
| 183 | id, filename); |
| 184 | return(0); |
| 185 | } |
| 186 | xmlCtxtSetErrorHandler(ctxt, testErrorHandler, NULL); |
| 187 | doc = xmlCtxtReadFile(ctxt, filename, NULL, options); |
| 188 | if (doc == NULL) { |
| 189 | test_log("test %s : %s invalid document turned not well-formed too\n", |
| 190 | id, filename); |
| 191 | } else { |
| 192 | /* invalidity should be reported both in the context and in the document */ |
| 193 | if ((ctxt->valid != 0) || (doc->properties & XML_DOC_DTDVALID)) { |
| 194 | test_log("test %s : %s failed to detect invalid document\n", |
| 195 | id, filename); |
| 196 | nb_errors++; |
| 197 | ret = 0; |
| 198 | } |
| 199 | xmlFreeDoc(doc); |
| 200 | } |
| 201 | xmlFreeParserCtxt(ctxt); |
| 202 | return(ret); |
| 203 | } |
| 204 | |
| 205 | static int |
| 206 | xmlconfTestValid(const char *id, const char *filename, int options) { |
no test coverage detected