X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Ftags.t;h=91edf08dd90eb8a636ceef7734b1a128fa753d55;hb=59ccc1e85596c73f96fce832d900fe72a764f230;hp=b7857ca4bb25fb1bc6c7cbabeed3f5b38b8408f0;hpb=afe60e532ca8e2bd54a49ed048238710eff71d72;p=catagits%2FWeb-Simple.git diff --git a/t/tags.t b/t/tags.t index b7857ca..91edf08 100644 --- a/t/tags.t +++ b/t/tags.t @@ -19,10 +19,53 @@ use Test::More qw(no_plan); 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(', ', Foo::foo()), + join(', ', XML::Tags::to_xml_string Foo::foo()), ', , ', 'open tags ok' ); @@ -30,7 +73,56 @@ is( ok(!eval { Foo::bar(); 1 }, 'Death on use of unimported tag'); is( - join(', ', Foo::baz()), + 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' +);