Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: third_party/libxml/src/runtest.c

Issue 2414643002: Roll libxml to 3169602058bd2d04913909e869c61d1540bc7fb4 (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxml/src/relaxng.c ('k') | third_party/libxml/src/win32/VC10/README.vc10 » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * runtest.c: C program to run libxml2 regression tests without 2 * runtest.c: C program to run libxml2 regression tests without
3 * requiring make or Python, and reducing platform dependancies 3 * requiring make or Python, and reducing platform dependancies
4 * to a strict minimum. 4 * to a strict minimum.
5 * 5 *
6 * To compile on Unixes: 6 * To compile on Unixes:
7 * cc -o runtest `xml2-config --cflags` runtest.c `xml2-config --libs` -lpthread 7 * cc -o runtest `xml2-config --cflags` runtest.c `xml2-config --libs` -lpthread
8 * 8 *
9 * See Copyright for the status of this software. 9 * See Copyright for the status of this software.
10 * 10 *
(...skipping 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 /************************************************************************ 2310 /************************************************************************
2311 * * 2311 * *
2312 * XPath and XPointer based tests * 2312 * XPath and XPointer based tests *
2313 * * 2313 * *
2314 ************************************************************************/ 2314 ************************************************************************/
2315 2315
2316 static FILE *xpathOutput; 2316 static FILE *xpathOutput;
2317 static xmlDocPtr xpathDocument; 2317 static xmlDocPtr xpathDocument;
2318 2318
2319 static void 2319 static void
2320 ignoreGenericError(void *ctx ATTRIBUTE_UNUSED,
2321 const char *msg ATTRIBUTE_UNUSED, ...) {
2322 }
2323
2324 static void
2320 testXPath(const char *str, int xptr, int expr) { 2325 testXPath(const char *str, int xptr, int expr) {
2326 xmlGenericErrorFunc handler = ignoreGenericError;
2321 xmlXPathObjectPtr res; 2327 xmlXPathObjectPtr res;
2322 xmlXPathContextPtr ctxt; 2328 xmlXPathContextPtr ctxt;
2323 2329
2330 /* Don't print generic errors to stderr. */
2331 initGenericErrorDefaultFunc(&handler);
2332
2324 nb_tests++; 2333 nb_tests++;
2325 #if defined(LIBXML_XPTR_ENABLED) 2334 #if defined(LIBXML_XPTR_ENABLED)
2326 if (xptr) { 2335 if (xptr) {
2327 ctxt = xmlXPtrNewContext(xpathDocument, NULL, NULL); 2336 ctxt = xmlXPtrNewContext(xpathDocument, NULL, NULL);
2328 res = xmlXPtrEval(BAD_CAST str, ctxt); 2337 res = xmlXPtrEval(BAD_CAST str, ctxt);
2329 } else { 2338 } else {
2330 #endif 2339 #endif
2331 ctxt = xmlXPathNewContext(xpathDocument); 2340 ctxt = xmlXPathNewContext(xpathDocument);
2332 ctxt->node = xmlDocGetRootElement(xpathDocument); 2341 ctxt->node = xmlDocGetRootElement(xpathDocument);
2333 if (expr) 2342 if (expr)
2334 res = xmlXPathEvalExpression(BAD_CAST str, ctxt); 2343 res = xmlXPathEvalExpression(BAD_CAST str, ctxt);
2335 else { 2344 else {
2336 /* res = xmlXPathEval(BAD_CAST str, ctxt); */ 2345 /* res = xmlXPathEval(BAD_CAST str, ctxt); */
2337 xmlXPathCompExprPtr comp; 2346 xmlXPathCompExprPtr comp;
2338 2347
2339 comp = xmlXPathCompile(BAD_CAST str); 2348 comp = xmlXPathCompile(BAD_CAST str);
2340 if (comp != NULL) { 2349 if (comp != NULL) {
2341 res = xmlXPathCompiledEval(comp, ctxt); 2350 res = xmlXPathCompiledEval(comp, ctxt);
2342 xmlXPathFreeCompExpr(comp); 2351 xmlXPathFreeCompExpr(comp);
2343 } else 2352 } else
2344 res = NULL; 2353 res = NULL;
2345 } 2354 }
2346 #if defined(LIBXML_XPTR_ENABLED) 2355 #if defined(LIBXML_XPTR_ENABLED)
2347 } 2356 }
2348 #endif 2357 #endif
2349 xmlXPathDebugDumpObject(xpathOutput, res, 0); 2358 xmlXPathDebugDumpObject(xpathOutput, res, 0);
2350 xmlXPathFreeObject(res); 2359 xmlXPathFreeObject(res);
2351 xmlXPathFreeContext(ctxt); 2360 xmlXPathFreeContext(ctxt);
2361
2362 /* Reset generic error handler. */
2363 initGenericErrorDefaultFunc(NULL);
2352 } 2364 }
2353 2365
2354 /** 2366 /**
2355 * xpathExprTest: 2367 * xpathExprTest:
2356 * @filename: the file to parse 2368 * @filename: the file to parse
2357 * @result: the file with expected result 2369 * @result: the file with expected result
2358 * @err: the file with error messages 2370 * @err: the file with error messages
2359 * 2371 *
2360 * Parse a file containing XPath standalone expressions and evaluate them 2372 * Parse a file containing XPath standalone expressions and evaluate them
2361 * 2373 *
(...skipping 2157 matching lines...) Expand 10 before | Expand all | Expand 10 after
4519 return(ret); 4531 return(ret);
4520 } 4532 }
4521 4533
4522 #else /* ! LIBXML_OUTPUT_ENABLED */ 4534 #else /* ! LIBXML_OUTPUT_ENABLED */
4523 int 4535 int
4524 main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) { 4536 main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED) {
4525 fprintf(stderr, "runtest requires output to be enabled in libxml2\n"); 4537 fprintf(stderr, "runtest requires output to be enabled in libxml2\n");
4526 return(1); 4538 return(1);
4527 } 4539 }
4528 #endif 4540 #endif
OLDNEW
« no previous file with comments | « third_party/libxml/src/relaxng.c ('k') | third_party/libxml/src/win32/VC10/README.vc10 » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698