| 1 |
#!/usr/bin/env python3 |
| 2 |
import sys |
| 3 |
import setup_test |
| 4 |
import libxml2 |
| 5 |
|
| 6 |
# Memory debug specific |
| 7 |
libxml2.debugMemory(1) |
| 8 |
|
| 9 |
doc = libxml2.parseFile("tst.xml") |
| 10 |
if doc.name != "tst.xml": |
| 11 |
print("doc.name failed") |
| 12 |
sys.exit(1) |
| 13 |
root = doc.children |
| 14 |
if root.name != "doc": |
| 15 |
print("root.name failed") |
| 16 |
sys.exit(1) |
| 17 |
child = root.children |
| 18 |
if child.name != "foo": |
| 19 |
print("child.name failed") |
| 20 |
sys.exit(1) |
| 21 |
doc.freeDoc() |
| 22 |
|
| 23 |
# Memory debug specific |
| 24 |
libxml2.cleanupParser() |
| 25 |
if libxml2.debugMemory(1) == 0: |
| 26 |
print("OK") |
| 27 |
else: |
| 28 |
print("Memory leak %d bytes" % (libxml2.debugMemory(1))) |