basic HTML tags
[catagits/Web-Simple.git] / t / tags.t
1 use strict; use warnings FATAL => 'all';
2 use Test::More qw(no_plan);
3
4 {
5
6   package Foo;
7
8   sub foo {
9     use XML::Tags qw(one two three);
10     <one>, <two>, <three>;
11   }
12
13   sub bar {
14     no warnings 'once'; # this is supposed to warn, it's broken
15     <one>
16   }
17
18   sub baz {
19     use XML::Tags qw(bar);
20     </bar>;
21   }
22
23   sub quux {
24     use HTML::Tags;
25     <html>, <body id="spoon">, "YAY", </body>, </html>;
26   }
27 }
28
29 is(
30   join(', ', Foo::foo()),
31   '<one>, <two>, <three>',
32   'open tags ok'
33 );
34
35 ok(!eval { Foo::bar(); 1 }, 'Death on use of unimported tag');
36
37 is(
38   join(', ', Foo::baz()),
39   '</bar>',
40   'close tag ok'
41 );
42
43 is(
44   join('', Foo::quux),
45   '<html><body id="spoon">YAY</body></html>',
46   'HTML tags ok'
47 );