t/tags.t: HTML tags which conflict with Perl built-ins ok
Jakub Narebski [Wed, 16 Dec 2009 21:12:23 +0000 (22:12 +0100)]
Check that tags which conflict with built-in Perl functions or
operators correctly: tested for <link>, <tr> and <sub> elements.

While at it check that <elem ... /> form for elements without closing
tag, like <link> element, works correctly.

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

t/tags.t

index 46e5c8a..b82a439 100644 (file)
--- a/t/tags.t
+++ b/t/tags.t
@@ -25,6 +25,12 @@ use Test::More qw(no_plan);
     <html>, <body id="spoon">, "YAY", </body>, </html>;
   }
 
+  sub xquux {
+    use HTML::Tags;
+    <link href="#self" rel="me" />,
+    <table>,<tr>,<td>,'x',<sub>,1,</sub>,</td>,</tr>,</table>;
+  }
+
   sub fleem {
     use XML::Tags qw(woo);
     my $ent = 'one&two<three>"four';
@@ -74,6 +80,13 @@ is(
 );
 
 is(
+  join('', HTML::Tags::to_html_string Foo::xquux),
+  '<link href="#self" rel="me" />' .
+  '<table><tr><td>x<sub>1</sub></td></tr></table>',
+  'Conflicting HTML tags ok'
+);
+
+is(
   join('', XML::Tags::to_xml_string Foo::fleem),
   '<woo ent="one&amp;two&lt;three&gt;&quot;four">',
   'Escaping ok'