From 51a7e103a0e3bbe122b006d9b5abaaa27cc64cf8 Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Thu, 1 Mar 2007 14:33:08 +0100 Subject: [PATCH 1/1] Add a structure test. --- perl/structure.pl | 11 +++++++++++ tests/reference/structure.xml | 22 ++++++++++++++++++++++ tests/test.sh | 2 +- xml/structure.xml | 20 ++++++++++++++++++++ 4 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 perl/structure.pl create mode 100644 tests/reference/structure.xml create mode 100644 xml/structure.xml diff --git a/perl/structure.pl b/perl/structure.pl new file mode 100644 index 0000000..8afcd8b --- /dev/null +++ b/perl/structure.pl @@ -0,0 +1,11 @@ +#! /usr/bin/perl +use XML::Template; + +my $doc = XML::Template::process_file('../xml/structure.xml', { + '#outer' => [ + { '#inner' => 'One' }, + { '#inner' => 'Two' }, + { '#inner' => 'Three' }, + ] +}); +print $doc->toString; diff --git a/tests/reference/structure.xml b/tests/reference/structure.xml new file mode 100644 index 0000000..62ed59b --- /dev/null +++ b/tests/reference/structure.xml @@ -0,0 +1,22 @@ + + + + + + </head> + <body> + <div> + <div> + <div>One</div> + </div> + + <div> + <div>Two</div> + </div> + + <div> + <div>Three</div> + </div> + </div> + </body> +</html> diff --git a/tests/test.sh b/tests/test.sh index b66ed38..0b09ea4 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -1,7 +1,7 @@ #! /bin/sh if [ -z "$TESTS" ]; then - TESTS="passthru simple clone include attribute attribute2 attribute3 attribute-empty namespace namespace2" + TESTS="passthru simple clone include attribute attribute2 attribute3 attribute-empty namespace namespace2 structure" fi if [ -z "$LANGUAGES" ]; then LANGUAGES="perl perl-sax php python ruby" diff --git a/xml/structure.xml b/xml/structure.xml new file mode 100644 index 0000000..1de25dd --- /dev/null +++ b/xml/structure.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<!DOCTYPE + html PUBLIC "-//W3C//DTD XHTML 1.1//EN" + "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:t="http://template.sesse.net/" xml:lang="en"> + <head> + <title /> + </head> + <body> + <div t:id="outer"> + <div> + <div t:id="inner"> + This is a test of how well cloning and substitution deals with multiple elements with the + same tag inside each other. It shouldn't get confused, as the names don't + really matter, but then again, it might. + </div> + </div> + </div> + </body> +</html> -- 2.39.2