VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/python/tests/resolver.py@ 8268

最後變更 在這個檔案從8268是 6076,由 vboxsync 提交於 17 年 前

Merged dmik/s2 branch (r25959:26751) to the trunk.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Date Revision Author Id
檔案大小: 777 位元組
 
1#!/usr/bin/python -u
2import sys
3import libxml2
4import StringIO
5
6# Memory debug specific
7libxml2.debugMemory(1)
8
9def myResolver(URL, ID, ctxt):
10 return(StringIO.StringIO("<foo/>"))
11
12libxml2.setEntityLoader(myResolver)
13
14doc = libxml2.parseFile("doesnotexist.xml")
15root = doc.children
16if root.name != "foo":
17 print "root element name error"
18 sys.exit(1)
19doc.freeDoc()
20
21i = 0
22while i < 5000:
23 doc = libxml2.parseFile("doesnotexist.xml")
24 root = doc.children
25 if root.name != "foo":
26 print "root element name error"
27 sys.exit(1)
28 doc.freeDoc()
29 i = i + 1
30
31
32# Memory debug specific
33libxml2.cleanupParser()
34if libxml2.debugMemory(1) == 0:
35 print "OK"
36else:
37 print "Memory leak %d bytes" % (libxml2.debugMemory(1))
38 libxml2.dumpMemory()
39
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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