Update of /cvsroot/perl-xml/xml-simple/t
In directory sc8-pr-cvs1:/tmp/cvs-serv19094/t
Modified Files:
2_XMLout.t
Log Message:
- fixed circular reference check (patch from Theo Lengyel)
Index: 2_XMLout.t
===================================================================
RCS file: /cvsroot/perl-xml/xml-simple/t/2_XMLout.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- 2_XMLout.t 16 Oct 2002 09:43:35 -0000 1.4
+++ 2_XMLout.t 20 Jan 2003 07:48:10 -0000 1.5
@@ -5,7 +5,7 @@
use Test::More;
use IO::File;
-plan tests => 172;
+plan tests => 174;
##############################################################################
# S U P P O R T R O U T I N E S
@@ -310,6 +310,23 @@
ok(!defined($_), 'caught circular data structure');
like($@, qr/circular data structures not supported/,
'with correct error message');
+
+
+# Try encoding a repetitive (but non-circular) data structure and confirm that
+# it does not fail
+
+$_ = eval {
+ my $a = { alpha => 1 };
+ my $ref = { a => $a, b => $a };
+ XMLout($ref);
+};
+ok(defined($_), 'repetitive (non-circular) data structure not fatal');
+like($_, qr{^
+<opt>
+ \s*<a\s+alpha="1"\s*/>
+ \s*<b\s+alpha="1"\s*/>
+\s*</opt>
+}xs, 'and encodes as expected');
# Try encoding a blessed reference and confirm that it fails
|