From: Grant M. <gr...@us...> - 2005-04-20 20:04:01
|
Update of /cvsroot/perl-xml/xml-filter-sort/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21097/t Modified Files: 1_buffer.t 4_workout.t Log Message: - add tests for '0' in sort key Index: 1_buffer.t =================================================================== RCS file: /cvsroot/perl-xml/xml-filter-sort/t/1_buffer.t,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- 1_buffer.t 14 Jun 2002 20:39:55 -0000 1.1.1.1 +++ 1_buffer.t 20 Apr 2005 20:03:52 -0000 1.2 @@ -143,6 +143,7 @@ <lastname>Boozle</lastname> <age unit='year'>35</age> <empty /> + <zero>0</zero> </person>); my(@keyvals); Index: 4_workout.t =================================================================== RCS file: /cvsroot/perl-xml/xml-filter-sort/t/4_workout.t,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- 4_workout.t 20 Apr 2005 02:33:14 -0000 1.2 +++ 4_workout.t 20 Apr 2005 20:03:53 -0000 1.3 @@ -19,7 +19,7 @@ } -plan tests => 25; +plan tests => 26; use XML::Filter::Sort; use XML::SAX::Machines qw( :all ); @@ -949,6 +949,41 @@ ############################################################################## +# Test that text content of '0' doesn't give us grief (any more). +# + +$xmlin = q(<list> + <prefix>0</prefix> + <item>9</item> + <item>5</item> + <item>0</item> + <item>7</item> + <suffix>0</suffix> +</list>); + +$xmlout = ''; + +@opts = (Record => 'item', Keys => '., num, asc'); +push @opts, @main::TempOpts; + +$sorter = Pipeline( + XML::Filter::Sort->new(@opts) => \$xmlout +); +$sorter->parse_string($xmlin); +fix_xml($xmlout); + +is($xmlout, q(<list> + <prefix>0</prefix> + <item>0</item> + <item>5</item> + <item>7</item> + <item>9</item> + <suffix>0</suffix> +</list>), 'No problem with text content of "0" even in sort key'); + + + +############################################################################## # S U B R O U T I N E S ############################################################################## |