4 use lib '.', 't/lib','../blib/lib','./blib/lib';
5 use Test::More tests => 18;
7 BEGIN { use_ok('CGI::Pretty') };
9 # This is silly use_ok should take arguments
10 use CGI::Pretty (':all');
15 is(ol(li('fred'),li('ethel')), <<HTML, "basic indentation");
27 is(p('hi',pre('there'),'frog'), <<HTML, "<pre> tags");
34 is(h1({-align=>'CENTER'},'fred'), <<HTML, "open/close tag with attribute");
40 is(h1({-align=>undef},'fred'), <<HTML,"open/close tag with orphan attribute");
46 is(h1({-align=>'CENTER'},['fred','agnes']), <<HTML, "distributive tag with attribute");
55 is(p('hi',a({-href=>'frog'},'there'),'frog'), <<HTML, "as-is");
57 hi <a href="frog">there</a>
62 is(p([ qw( hi there frog ) ] ), <<HTML, "array-reference");
74 is(p(p(p('hi'), 'there' ), 'frog'), <<HTML, "nested tags");
86 is(table(TR(td(table(TR(td('hi', 'there', 'frog')))))), <<HTML, "nested as-is tags");
91 <td>hi there frog</td>
98 is(table(TR(td(table(TR(td( [ qw( hi there frog ) ])))))), <<HTML, "nested as-is array-reference");
112 $CGI::Pretty::INDENT = $CGI::Pretty::LINEBREAK = "";
114 is(h1(), '<h1 />',"single tag (pretty turned off)");
115 is(h1('fred'), '<h1>fred</h1>',"open/close tag (pretty turned off)");
116 is(h1('fred','agnes','maura'), '<h1>fred agnes maura</h1>',"open/close tag multiple (pretty turned off)");
117 is(h1({-align=>'CENTER'},'fred'), '<h1 align="CENTER">fred</h1>',"open/close tag with attribute (pretty turned off)");
118 is(h1({-align=>undef},'fred'), '<h1 align>fred</h1>',"open/close tag with orphan attribute (pretty turned off)");
119 is(h1({-align=>'CENTER'},['fred','agnes']), '<h1 align="CENTER">fred</h1> <h1 align="CENTER">agnes</h1>',
120 "distributive tag with attribute (pretty turned off)");