Last change
on this file since 105420 was 105420, checked in by vboxsync, 7 months ago |
libxml2-2.12.6: Applied and adjusted our libxml2 changes to 2.12.6. bugref:10730
|
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/env python3
|
---|
2 | import setup_test
|
---|
3 | import libxml2
|
---|
4 | import sys
|
---|
5 |
|
---|
6 | libxml2.debugMemory(True)
|
---|
7 |
|
---|
8 | expect="""--> Invalid expression
|
---|
9 | --> Invalid expression
|
---|
10 | --> Invalid expression
|
---|
11 | --> Invalid expression
|
---|
12 | --> Invalid expression
|
---|
13 | --> Invalid expression
|
---|
14 | --> Invalid expression
|
---|
15 | --> Invalid expression
|
---|
16 | --> Invalid expression
|
---|
17 | --> Invalid expression
|
---|
18 | """
|
---|
19 | err=""
|
---|
20 | def callback(ctx, str):
|
---|
21 | global err
|
---|
22 |
|
---|
23 | err = err + "%s %s" % (ctx, str)
|
---|
24 |
|
---|
25 | libxml2.registerErrorHandler(callback, "-->")
|
---|
26 |
|
---|
27 | doc = libxml2.parseDoc("<fish/>")
|
---|
28 | ctxt = doc.xpathNewContext()
|
---|
29 | ctxt.setContextNode(doc)
|
---|
30 | badexprs = (
|
---|
31 | ":false()", "bad:()", "bad(:)", ":bad(:)", "bad:(:)", "bad:bad(:)",
|
---|
32 | "a:/b", "/c:/d", "//e:/f", "g://h"
|
---|
33 | )
|
---|
34 | for expr in badexprs:
|
---|
35 | try:
|
---|
36 | ctxt.xpathEval(expr)
|
---|
37 | except libxml2.xpathError:
|
---|
38 | pass
|
---|
39 | else:
|
---|
40 | print("Unexpectedly legal expression:", expr)
|
---|
41 | ctxt.xpathFreeContext()
|
---|
42 | doc.freeDoc()
|
---|
43 |
|
---|
44 | if err != expect:
|
---|
45 | print("error")
|
---|
46 | print("received %s" %(err))
|
---|
47 | print("expected %s" %(expect))
|
---|
48 | sys.exit(1)
|
---|
49 |
|
---|
50 | libxml2.cleanupParser()
|
---|
51 | leakedbytes = libxml2.debugMemory(True)
|
---|
52 | if leakedbytes == 0:
|
---|
53 | print("OK")
|
---|
54 | else:
|
---|
55 | print("Memory leak", leakedbytes, "bytes")
|
---|
Note:
See
TracBrowser
for help on using the repository browser.