use strict; use warnings FATAL => 'all'; use Test::More qw(no_plan); { package Foo; sub foo { use XML::Tags qw(one two three); , , ; } sub bar { no warnings 'once'; # this is supposed to warn, it's broken } sub baz { use XML::Tags qw(bar); ; } sub quux { use HTML::Tags; , , "YAY", , ; } sub xquux { use HTML::Tags; , ,,,,
,'x',,1,,
; } sub fleem { use XML::Tags qw(woo); my $ent = 'one&two"four'; ; } sub flaax { use XML::Tags qw(woo); my $data = "one&twofour"; , $data, , , \$data, ; } sub HTML_comment { use HTML::Tags; ; } sub PI { use XML::Tags; ; } sub DTD { use HTML::Tags; } sub globbery { ; } } is( join(', ', XML::Tags::to_xml_string Foo::foo()), ', , ', 'open tags ok' ); ok(!eval { Foo::bar(); 1 }, 'Death on use of unimported tag'); is( join(', ', XML::Tags::to_xml_string Foo::baz()), '', 'close tag ok' ); is( join('', HTML::Tags::to_html_string Foo::quux), 'YAY', 'HTML tags ok' ); is( join('', HTML::Tags::to_html_string Foo::xquux), '' . '
x1
', 'Conflicting HTML tags ok' ); is( join('', XML::Tags::to_xml_string Foo::HTML_comment), '', 'HTML comment ok' ); is( join('', XML::Tags::to_xml_string Foo::fleem), '', 'Escaping ok' ); is( join('', XML::Tags::to_xml_string Foo::flaax), 'one&two<three>fourone&twofour', 'Escaping user data ok' ); is( join('', XML::Tags::to_xml_string Foo::PI), '', 'XML processing instruction' ); is( join('', HTML::Tags::to_html_string Foo::DTD), '', 'DTD ok' ); is( join(', ', Foo::globbery), 't/globbery/one, t/globbery/two', 'real glob re-installed ok' );