From: sgunderson@bigfoot.com <> Date: Wed, 4 Oct 2006 01:02:48 +0000 (+0200) Subject: Add a new "attribute3" test, for testing undef/NULL/None behaviour (new X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8a0246fb0c04af3297d2d741b1b2fadfb0cd99ad;hp=2d0267909d7dcb79165a08aec236a53638dbaf84;p=xml-template Add a new "attribute3" test, for testing undef/NULL/None behaviour (new in spec, all fail). --- diff --git a/perl/attribute3.pl b/perl/attribute3.pl new file mode 100644 index 0000000..1924c03 --- /dev/null +++ b/perl/attribute3.pl @@ -0,0 +1,14 @@ +#! /usr/bin/perl +use XML::Template; + +my $doc = XML::Template::process_file('../xml/clone.xml', { + 'color' => 'blue', + '#things' => XML::Template::alternate('li/class', [ + { 'li' => 'Raindrops on roses' }, + { 'li' => 'Whiskers on kittens' }, + undef, + { 'li' => 'Bright copper kettles' }, + { 'li' => 'Warm, woolen mittens'}, + ], 'odd', 'even') +}); +print $doc->toString; diff --git a/php/attribute3.php b/php/attribute3.php new file mode 100644 index 0000000..f4fa718 --- /dev/null +++ b/php/attribute3.php @@ -0,0 +1,15 @@ + 'blue', + '#things' => XML_Template_alternate('li/class', array( + array( 'li' => 'Raindrops on roses' ), + array( 'li' => 'Whiskers on kittens' ), + NULL, + array( 'li' => 'Bright copper kettles' ), + array( 'li' => 'Warm, woolen mittens' ), + ), array('odd', 'even')) +)); +print $doc->dump_mem(); +?> diff --git a/python/attribute3.py b/python/attribute3.py new file mode 100644 index 0000000..9c6ffbf --- /dev/null +++ b/python/attribute3.py @@ -0,0 +1,14 @@ +#! /usr/bin/python +import xmltemplate + +doc = xmltemplate.process_file("../xml/clone.xml", { + "color": "blue", + "#things": xmltemplate.alternate("li/class", [ + { "li": "Raindrops on roses" }, + { "li": "Whiskers on kittens" }, + None, + { "li": "Bright copper kettles" }, + { "li": "Warm, woolen mittens"}, + ], "odd", "even") +}); +print doc.toxml() diff --git a/tests/reference/attribute3.xml b/tests/reference/attribute3.xml new file mode 100644 index 0000000..d972834 --- /dev/null +++ b/tests/reference/attribute3.xml @@ -0,0 +1,16 @@ + + + + Cloning test + + +

My favourite color is blue; I like that very much. + All my favourite things:

+ + + diff --git a/tests/test.sh b/tests/test.sh index 19c6cf9..38ab5e4 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 attribute-empty" + TESTS="passthru simple clone include attribute attribute2 attribute3 attribute-empty" fi if [ -z "$LANGUAGES" ]; then LANGUAGES="perl php python"