From 8a0246fb0c04af3297d2d741b1b2fadfb0cd99ad Mon Sep 17 00:00:00 2001 From: "sgunderson@bigfoot.com" <> Date: Wed, 4 Oct 2006 03:02:48 +0200 Subject: [PATCH] Add a new "attribute3" test, for testing undef/NULL/None behaviour (new in spec, all fail). --- perl/attribute3.pl | 14 ++++++++++++++ php/attribute3.php | 15 +++++++++++++++ python/attribute3.py | 14 ++++++++++++++ tests/reference/attribute3.xml | 16 ++++++++++++++++ tests/test.sh | 2 +- 5 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 perl/attribute3.pl create mode 100644 php/attribute3.php create mode 100644 python/attribute3.py create mode 100644 tests/reference/attribute3.xml 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" -- 2.39.2