diff options
author | Daniel Veillard <veillard@src.gnome.org> | 2001-01-30 14:19:41 +0000 |
---|---|---|
committer | Daniel Veillard <veillard@src.gnome.org> | 2001-01-30 14:19:41 +0000 |
commit | 48a443da0ae1a1e7d50006acb56a58027709fb80 (patch) | |
tree | ebe87cf83fe37b347ec3e6ec3307183929eaf0fb | |
parent | dfcbad530f14df75eaf558f585f4e71dd7f212f0 (diff) | |
download | libxslt-48a443da0ae1a1e7d50006acb56a58027709fb80.tar.gz libxslt-48a443da0ae1a1e7d50006acb56a58027709fb80.tar.bz2 libxslt-48a443da0ae1a1e7d50006acb56a58027709fb80.zip |
Boring task of starting doing basic testsuite:
- TODO: updated
- configure.in tests/Makefile.am tests/REC/*: started adding
some regression tests based from fragments of spec examples
- libxslt/transform.c: fixed a problem on namespace generation
Daniel
30 files changed, 225 insertions, 2 deletions
@@ -1,3 +1,10 @@ +Tue Jan 30 15:16:56 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> + + * TODO: updated + * configure.in tests/Makefile.am tests/REC/*: started adding + some regression tests based from fragments of spec examples + * libxslt/transform.c: fixed a problem on namespace generation + Mon Jan 29 18:40:23 CET 2001 Daniel Veillard <Daniel.Veillard@imag.fr> * FEATURES: updated @@ -27,6 +27,10 @@ Extra functions: ID and Key support: -> Id should be simple, key will probably requires some hash tables. +Templates: + -> check the built-in template rule for attributes + -> make sure @xxx matches are applied + Pattern tester: -> try to optimize for ID scan and tests. @@ -37,6 +41,7 @@ Error handling: -> check the version stuff, design a separate module for error interfacing and default handling, parsing vs. runtime, fatal / compat / warning, and lack of optionnal features. + -> catch recursion end of 5.4 ... Support Attribute value templates: -> optimization by checking their existence at stylesheet parse time. diff --git a/configure.in b/configure.in index 08cd778d..a82f44bc 100644 --- a/configure.in +++ b/configure.in @@ -146,6 +146,7 @@ libxslt/xsltconfig.h tests/Makefile tests/REC1/Makefile tests/REC2/Makefile +tests/REC/Makefile tests/numbers/Makefile doc/Makefile xslt-config diff --git a/libxslt/transform.c b/libxslt/transform.c index 4b761b54..96e18844 100644 --- a/libxslt/transform.c +++ b/libxslt/transform.c @@ -130,7 +130,7 @@ xsltCopyNode(xsltTransformContextPtr ctxt, xmlNodePtr node, if (node->nsDef != NULL) xsltCopyNamespaceList(ctxt, copy, node->nsDef); if (node->ns != NULL) { - copy->ns = xsltGetNamespace(ctxt, node, node->ns, insert); + copy->ns = xsltGetNamespace(ctxt, node, node->ns, copy); } } else { xsltGenericError(xsltGenericErrorContext, diff --git a/tests/Makefile.am b/tests/Makefile.am index 121818a7..784cee17 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS=REC1 REC2 numbers +SUBDIRS=REC1 REC2 REC numbers test tests: all diff --git a/tests/REC/Makefile.am b/tests/REC/Makefile.am new file mode 100644 index 00000000..8593d962 --- /dev/null +++ b/tests/REC/Makefile.am @@ -0,0 +1,22 @@ +## Process this file with automake to produce Makefile.in + +$(top_builddir)/libxslt/xsltproc: + @(cd ../../libxslt ; make xsltproc) + +EXTRA_DIST = doc.xsl doc.xml result.xml + +all: test + +test tests: $(top_builddir)/libxslt/xsltproc + @(rm -f .memdump ; touch .memdump) + @(for i in *.xsl ; do \ + name=`basename $$i .xsl` ; \ + if [ ! -f $$name.xml ] ; then continue ; fi ; \ + echo $$name.xml ; \ + $(top_builddir)/libxslt/xsltproc $$name.xsl $$name.xml > $$name.res;\ + if [ ! -f $$name.out ] ; then cp $$name.res $$name.out ; \ + else diff $$name.out $$name.res ; fi ; \ + grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0";\ + rm -f $$name.res ; \ + done) + diff --git a/tests/REC/test-5.3.out b/tests/REC/test-5.3.out new file mode 100644 index 00000000..eb2756a2 --- /dev/null +++ b/tests/REC/test-5.3.out @@ -0,0 +1,6 @@ +<?xml version="1.0"?> + +This is an +<fo:inline-sequence xmlns:fo="http://www.w3.org/1999/XSL/Format" font-weight="bold">important</fo:inline-sequence> + point. + diff --git a/tests/REC/test-5.3.xml b/tests/REC/test-5.3.xml new file mode 100644 index 00000000..2a95ab30 --- /dev/null +++ b/tests/REC/test-5.3.xml @@ -0,0 +1,3 @@ +<doc> +This is an <emph>important</emph> point. +</doc> diff --git a/tests/REC/test-5.3.xsl b/tests/REC/test-5.3.xsl new file mode 100644 index 00000000..48131042 --- /dev/null +++ b/tests/REC/test-5.3.xsl @@ -0,0 +1,9 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format"> +<xsl:template match="emph"> + <fo:inline-sequence font-weight="bold"> + <xsl:apply-templates/> + </fo:inline-sequence> +</xsl:template> +</xsl:stylesheet> diff --git a/tests/REC/test-5.4-1.out b/tests/REC/test-5.4-1.out new file mode 100644 index 00000000..d4db6019 --- /dev/null +++ b/tests/REC/test-5.4-1.out @@ -0,0 +1,7 @@ +<?xml version="1.0"?> +<doc> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"> +This is a chapter +</fo:block> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format">This is another chapter</fo:block> +</doc> diff --git a/tests/REC/test-5.4-1.xml b/tests/REC/test-5.4-1.xml new file mode 100644 index 00000000..388cac7b --- /dev/null +++ b/tests/REC/test-5.4-1.xml @@ -0,0 +1,6 @@ +<doc> +<chapter> +This is a chapter +</chapter> +<chapter>This is <em>another</em> chapter</chapter> +</doc> diff --git a/tests/REC/test-5.4-1.xsl b/tests/REC/test-5.4-1.xsl new file mode 100644 index 00000000..55b3974e --- /dev/null +++ b/tests/REC/test-5.4-1.xsl @@ -0,0 +1,14 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format"> +<xsl:template match="chapter"> + <fo:block> + <xsl:apply-templates/> + </fo:block> +</xsl:template> +<xsl:template match="doc"> +<doc> + <xsl:apply-templates/> +</doc> +</xsl:template> +</xsl:stylesheet> diff --git a/tests/REC/test-5.4-2.out b/tests/REC/test-5.4-2.out new file mode 100644 index 00000000..2e32bff5 --- /dev/null +++ b/tests/REC/test-5.4-2.out @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<doc> +<fo:inline-sequence xmlns:fo="http://www.w3.org/1999/XSL/Format">name1name2</fo:inline-sequence> +</doc> diff --git a/tests/REC/test-5.4-2.xml b/tests/REC/test-5.4-2.xml new file mode 100644 index 00000000..ea0f40a7 --- /dev/null +++ b/tests/REC/test-5.4-2.xml @@ -0,0 +1,7 @@ +<doc> +<author-group> +<author>name1</author> +<author>name2</author> +<info>skipped</info> +</author-group> +</doc> diff --git a/tests/REC/test-5.4-2.xsl b/tests/REC/test-5.4-2.xsl new file mode 100644 index 00000000..cc43c5c5 --- /dev/null +++ b/tests/REC/test-5.4-2.xsl @@ -0,0 +1,16 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format"> +<xsl:template match="doc"> +<doc> + <xsl:apply-templates/> +</doc> +</xsl:template> + +<xsl:template match="author-group"> + <fo:inline-sequence> + <xsl:apply-templates select="author"/> + </fo:inline-sequence> +</xsl:template> + +</xsl:stylesheet> diff --git a/tests/REC/test-5.4-3.out b/tests/REC/test-5.4-3.out new file mode 100644 index 00000000..2e32bff5 --- /dev/null +++ b/tests/REC/test-5.4-3.out @@ -0,0 +1,4 @@ +<?xml version="1.0"?> +<doc> +<fo:inline-sequence xmlns:fo="http://www.w3.org/1999/XSL/Format">name1name2</fo:inline-sequence> +</doc> diff --git a/tests/REC/test-5.4-3.xml b/tests/REC/test-5.4-3.xml new file mode 100644 index 00000000..6cd54f5a --- /dev/null +++ b/tests/REC/test-5.4-3.xml @@ -0,0 +1,7 @@ +<doc> +<author-group> +<author><given-name>name1</given-name></author> +<author><given-name>name2</given-name></author> +<author>skipped</author> +</author-group> +</doc> diff --git a/tests/REC/test-5.4-3.xsl b/tests/REC/test-5.4-3.xsl new file mode 100644 index 00000000..c367a82a --- /dev/null +++ b/tests/REC/test-5.4-3.xsl @@ -0,0 +1,16 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format"> +<xsl:template match="doc"> +<doc> + <xsl:apply-templates/> +</doc> +</xsl:template> + +<xsl:template match="author-group"> + <fo:inline-sequence> + <xsl:apply-templates select="author/given-name"/> + </fo:inline-sequence> +</xsl:template> + +</xsl:stylesheet> diff --git a/tests/REC/test-5.4-4.out b/tests/REC/test-5.4-4.out new file mode 100644 index 00000000..43191ba3 --- /dev/null +++ b/tests/REC/test-5.4-4.out @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<doc><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"> + Employee employee1 belongs to group + group1</fo:block><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"> + Employee employee3 belongs to group + group1</fo:block><fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"> + Employee employee2 belongs to group + group2</fo:block></doc> diff --git a/tests/REC/test-5.4-4.xml b/tests/REC/test-5.4-4.xml new file mode 100644 index 00000000..baf95dc8 --- /dev/null +++ b/tests/REC/test-5.4-4.xml @@ -0,0 +1,17 @@ +<doc> +<department> +<name>dept1</name> +<group> +<name>group1</name> +<employee><name>employee1</name></employee> +<employee><name>employee3</name></employee> +</group> +</department> +<department> +<name>dept2</name> +<group> +<name>group2</name> +<employee><name>employee2</name></employee> +</group> +</department> +</doc> diff --git a/tests/REC/test-5.4-4.xsl b/tests/REC/test-5.4-4.xsl new file mode 100644 index 00000000..f530170f --- /dev/null +++ b/tests/REC/test-5.4-4.xsl @@ -0,0 +1,20 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fo="http://www.w3.org/1999/XSL/Format"> +<xsl:template match="doc"> +<doc> + <xsl:apply-templates select="//employee"/> +</doc> +</xsl:template> + +<xsl:template match="employee"> + <fo:block> + Employee <xsl:apply-templates select="name"/> belongs to group + <xsl:apply-templates select="ancestor::department/group"/> + </fo:block> +</xsl:template> +<xsl:template match="group"> +<xsl:apply-templates select="name"/> +</xsl:template> + +</xsl:stylesheet> diff --git a/tests/REC/test-5.4-5.out b/tests/REC/test-5.4-5.out new file mode 100644 index 00000000..1b24fa59 --- /dev/null +++ b/tests/REC/test-5.4-5.out @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +div found div found diff --git a/tests/REC/test-5.4-5.xml b/tests/REC/test-5.4-5.xml new file mode 100644 index 00000000..25c623b6 --- /dev/null +++ b/tests/REC/test-5.4-5.xml @@ -0,0 +1 @@ +<doc><div><div></div></div></doc> diff --git a/tests/REC/test-5.4-5.xsl b/tests/REC/test-5.4-5.xsl new file mode 100644 index 00000000..d0d192e1 --- /dev/null +++ b/tests/REC/test-5.4-5.xsl @@ -0,0 +1,10 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="doc"> + <xsl:apply-templates select=".//div"/> +</xsl:template> +<xsl:template match="div"> +<xsl:text>div found </xsl:text> +</xsl:template> +</xsl:stylesheet> diff --git a/tests/REC/test-5.8.out b/tests/REC/test-5.8.out new file mode 100644 index 00000000..409d2ef3 --- /dev/null +++ b/tests/REC/test-5.8.out @@ -0,0 +1,6 @@ +<?xml version="1.0"?> + + + + elem content + diff --git a/tests/REC/test-5.8.xml b/tests/REC/test-5.8.xml new file mode 100644 index 00000000..d0154e37 --- /dev/null +++ b/tests/REC/test-5.8.xml @@ -0,0 +1,7 @@ +<?tst-pi pi 1 ?> +<!-- comment 1 --> +<doc xmlns:unused="http://example.org/unused"> + <?tst-pi pi 2 ?> + <!-- comment 2 --> + <elem attr="attr value">elem content</elem> +</doc> diff --git a/tests/REC/test-5.8.xsl b/tests/REC/test-5.8.xsl new file mode 100644 index 00000000..8425792d --- /dev/null +++ b/tests/REC/test-5.8.xsl @@ -0,0 +1,4 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> +<!-- empty stylesheet --> +</xsl:stylesheet> diff --git a/tests/REC/test-6.out b/tests/REC/test-6.out new file mode 100644 index 00000000..baa12e98 --- /dev/null +++ b/tests/REC/test-6.out @@ -0,0 +1,2 @@ +<?xml version="1.0"?> +doc found diff --git a/tests/REC/test-6.xml b/tests/REC/test-6.xml new file mode 100644 index 00000000..76c01080 --- /dev/null +++ b/tests/REC/test-6.xml @@ -0,0 +1 @@ +<doc><div></div></doc> diff --git a/tests/REC/test-6.xsl b/tests/REC/test-6.xsl new file mode 100644 index 00000000..707e1103 --- /dev/null +++ b/tests/REC/test-6.xsl @@ -0,0 +1,11 @@ +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + +<xsl:template match="doc"> + <xsl:call-template name="docfound"/> +</xsl:template> + +<xsl:template name="docfound"> +<xsl:text>doc found</xsl:text> +</xsl:template> +</xsl:stylesheet> |