t/tags.t: Test escaping of attributes more extensively
Jakub Narebski [Tue, 15 Dec 2009 21:27:11 +0000 (22:27 +0100)]
Test escaping of attributes of XML element not only for '&', but also
for '<', '>' and '"'.

Test currently fails for escaping '"', which should be escaped as
'&quot;' (at least for attribute with value delimited with '"'), and
not as '&quot' (note missing ';').

Signed-off-by: Jakub Narebski <jnareb@gmail.com>

t/tags.t

index dc67654..46e5c8a 100644 (file)
--- a/t/tags.t
+++ b/t/tags.t
@@ -27,7 +27,7 @@ use Test::More qw(no_plan);
 
   sub fleem {
     use XML::Tags qw(woo);
-    my $ent = "one&two";
+    my $ent = 'one&two<three>"four';
     <woo ent="$ent">;
   }
 
@@ -75,7 +75,7 @@ is(
 
 is(
   join('', XML::Tags::to_xml_string Foo::fleem),
-  '<woo ent="one&amp;two">',
+  '<woo ent="one&amp;two&lt;three&gt;&quot;four">',
   'Escaping ok'
 );