1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
use strict; use warnings FATAL => 'all';
use Test::More qw(no_plan);
{
package Foo;
sub foo {
use XML::Tags qw(one two three);
<one>, <two>, <three>;
}
sub bar {
no warnings 'once'; # this is supposed to warn, it's broken
<one>
}
sub baz {
use XML::Tags qw(bar);
</bar>;
}
sub quux {
use HTML::Tags;
<html>, <body id="spoon">, "YAY", </body>, </html>;
}
sub fleem {
use XML::Tags qw(woo);
my $ent = "one&two";
<woo ent="$ent">;
}
sub globbery {
<t/globbery/*>;
}
}
is(
join(', ', XML::Tags::to_xml_string Foo::foo()),
'<one>, <two>, <three>',
'open tags ok'
);
ok(!eval { Foo::bar(); 1 }, 'Death on use of unimported tag');
is(
join(', ', XML::Tags::to_xml_string Foo::baz()),
'</bar>',
'close tag ok'
);
is(
join('', HTML::Tags::to_html_string Foo::quux),
'<html><body id="spoon">YAY</body></html>',
'HTML tags ok'
);
is(
join('', XML::Tags::to_xml_string Foo::fleem),
'<woo ent="one&two">',
'Escaping ok'
);
is(
join(', ', Foo::globbery),
't/globbery/one, t/globbery/two',
'real glob re-installed ok'
);
|