]> git.sesse.net Git - xml-template/commitdiff
Add a structure test.
authorsgunderson@bigfoot.com <>
Thu, 1 Mar 2007 13:33:08 +0000 (14:33 +0100)
committersgunderson@bigfoot.com <>
Thu, 1 Mar 2007 13:33:08 +0000 (14:33 +0100)
perl/structure.pl [new file with mode: 0644]
tests/reference/structure.xml [new file with mode: 0644]
tests/test.sh
xml/structure.xml [new file with mode: 0644]

diff --git a/perl/structure.pl b/perl/structure.pl
new file mode 100644 (file)
index 0000000..8afcd8b
--- /dev/null
@@ -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 (file)
index 0000000..62ed59b
--- /dev/null
@@ -0,0 +1,22 @@
+<?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" xml:lang="en">
+  <head>
+    <title/>
+  </head>
+  <body>
+    <div>
+      <div>
+        <div>One</div>
+      </div>
+    
+      <div>
+        <div>Two</div>
+      </div>
+    
+      <div>
+        <div>Three</div>
+      </div>
+    </div>
+  </body>
+</html>
index b66ed3812645e2d07d9fba3b6b64aec990ea568b..0b09ea4838f04de123a9ef297e129675d89829ce 100755 (executable)
@@ -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 (file)
index 0000000..1de25dd
--- /dev/null
@@ -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>