From f51dd67f3a3f472af0620391eb588eeca4533689 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 11 Nov 2004 12:53:54 +0000 Subject: Load /tmp/tmp.n9GTkp/libxml2-2.6.16 into packages/libxml2/branches/upstream/current. --- python/tests/Makefile.am | 6 ++++-- python/tests/Makefile.in | 6 ++++-- python/tests/dtdvalid.py | 32 ++++++++++++++++++++++++++++++++ python/tests/test.dtd | 1 + 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100755 python/tests/dtdvalid.py create mode 100644 python/tests/test.dtd (limited to 'python/tests') 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="""""" +instance=""" +""" + +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 @@ + -- cgit v1.2.3