mirror of
https://gitlab.gnome.org/GNOME/libxslt
synced 2025-08-05 23:35:48 +03:00
committed by
Nick Wellnhofer
parent
2c20c70cd8
commit
a2db8da1ac
@@ -1,7 +1,15 @@
|
||||
#!/usr/bin/python -u
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import string
|
||||
import StringIO
|
||||
import sys
|
||||
|
||||
if sys.version_info < (3, 0):
|
||||
import StringIO as io
|
||||
else:
|
||||
import io
|
||||
|
||||
import libxml2
|
||||
# Memory debug specific
|
||||
libxml2.debugMemory(1)
|
||||
@@ -34,7 +42,7 @@ def transform_test(ctx, node, inst, comp):
|
||||
pass
|
||||
|
||||
tctxt.insertNode().addContent('SUCCESS')
|
||||
|
||||
|
||||
|
||||
|
||||
styledoc = libxml2.parseDoc("""
|
||||
@@ -58,23 +66,23 @@ style.freeStylesheet()
|
||||
doc.freeDoc()
|
||||
|
||||
|
||||
extensions = StringIO.StringIO()
|
||||
extensions = io.StringIO()
|
||||
libxslt.debugDumpExtensions(extensions)
|
||||
|
||||
if 0 and extensions.buf.find(EXT_URL) < 0:
|
||||
print "Element extension not registered (or dumping broken)"
|
||||
print("Element extension not registered (or dumping broken)")
|
||||
sys.exit(1)
|
||||
|
||||
root = result.children
|
||||
|
||||
if root.name != "article":
|
||||
print "Unexpected root node name"
|
||||
print("Unexpected root node name")
|
||||
sys.exit(1)
|
||||
if root.content != "SUCCESS":
|
||||
print "Unexpected root node content, extension function failed"
|
||||
print("Unexpected root node content, extension function failed")
|
||||
sys.exit(1)
|
||||
if insertNodeName != 'article':
|
||||
print "The function callback failed to access its context"
|
||||
print("The function callback failed to access its context")
|
||||
sys.exit(1)
|
||||
|
||||
result.dump(sys.stdout)
|
||||
@@ -83,8 +91,8 @@ result.freeDoc()
|
||||
# Memory debug specific
|
||||
libxslt.cleanup()
|
||||
if libxml2.debugMemory(1) == 0:
|
||||
print "OK"
|
||||
print("OK")
|
||||
else:
|
||||
print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
||||
print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
|
||||
libxml2.dumpMemory()
|
||||
sys.exit(255)
|
||||
|
Reference in New Issue
Block a user