VirtualBox

source: vbox/trunk/src/libs/libxml2-2.13.2/python/tests/push.py

Last change on this file was 105420, checked in by vboxsync, 10 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: 764 bytes
Line 
1#!/usr/bin/env python3
2import sys
3import setup_test
4import libxml2
5
6# Memory debug specific
7libxml2.debugMemory(1)
8
9ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
10ctxt.parseChunk("/>", 2, 1)
11doc = ctxt.doc()
12ctxt=None
13if doc.name != "test.xml":
14 print("document name error")
15 sys.exit(1)
16root = doc.children
17if root.name != "foo":
18 print("root element name error")
19 sys.exit(1)
20doc.freeDoc()
21i = 10000
22while i > 0:
23 ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
24 ctxt.parseChunk("/>", 2, 1)
25 doc = ctxt.doc()
26 doc.freeDoc()
27 i = i -1
28ctxt=None
29
30# Memory debug specific
31libxml2.cleanupParser()
32if libxml2.debugMemory(1) == 0:
33 print("OK")
34else:
35 print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette