diff options
author | Mike Hommey <mh@glandium.org> | 2004-11-11 12:53:54 +0000 |
---|---|---|
committer | Mike Hommey <mh@glandium.org> | 2004-11-11 12:53:54 +0000 |
commit | f51dd67f3a3f472af0620391eb588eeca4533689 (patch) | |
tree | 9184c396c489196608427d5fa35814e86a1e479f /python/tests | |
parent | 9705f1a5e858108d21a0128556f42b25d16833cd (diff) | |
download | libxml2-upstream/2.6.16.tar.gz |
Load /tmp/tmp.n9GTkp/libxml2-2.6.16 intoupstream/2.6.16
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'python/tests')
-rw-r--r-- | python/tests/Makefile.am | 6 | ||||
-rw-r--r-- | python/tests/Makefile.in | 6 | ||||
-rwxr-xr-x | python/tests/dtdvalid.py | 32 | ||||
-rw-r--r-- | python/tests/test.dtd | 1 |
4 files changed, 41 insertions, 4 deletions
diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 722e0ec..1ae9b6c 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -36,12 +36,14 @@ PYTESTS= \ thread2.py \ sync.py \ tstLastError.py \ - indexes.py + indexes.py \ + dtdvalid.py XMLS= \ tst.xml \ valid.xml \ - invalid.xml + invalid.xml \ + test.dtd EXTRA_DIST = $(PYTESTS) $(XMLS) diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index 3b55268..9113a20 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -285,12 +285,14 @@ PYTESTS = \ thread2.py \ sync.py \ tstLastError.py \ - indexes.py + indexes.py \ + dtdvalid.py XMLS = \ tst.xml \ valid.xml \ - invalid.xml + invalid.xml \ + test.dtd EXTRA_DIST = $(PYTESTS) $(XMLS) all: all-am diff --git a/python/tests/dtdvalid.py b/python/tests/dtdvalid.py new file mode 100755 index 0000000..2011f2c --- /dev/null +++ b/python/tests/dtdvalid.py @@ -0,0 +1,32 @@ +#!/usr/bin/python -u +import libxml2 +import sys + +# Memory debug specific +libxml2.debugMemory(1) + +dtd="""<!ELEMENT foo EMPTY>""" +instance="""<?xml version="1.0"?> +<foo></foo>""" + +dtd = libxml2.parseDTD(None, 'test.dtd') +ctxt = libxml2.newValidCtxt() +doc = libxml2.parseDoc(instance) +ret = doc.validateDtd(ctxt, dtd) +if ret != 1: + print "error doing DTD validation" + sys.exit(1) + +doc.freeDoc() +dtd.freeDtd() +del dtd +del ctxt + +# Memory debug specific +libxml2.cleanupParser() +if libxml2.debugMemory(1) == 0: + print "OK" +else: + print "Memory leak %d bytes" % (libxml2.debugMemory(1)) + libxml2.dumpMemory() + diff --git a/python/tests/test.dtd b/python/tests/test.dtd new file mode 100644 index 0000000..b61b438 --- /dev/null +++ b/python/tests/test.dtd @@ -0,0 +1 @@ +<!ELEMENT foo EMPTY> |