4 use Test::More tests => 17;
5 use CGI::Pretty ':all';
10 is(ol(li('fred'),li('ethel')), <<HTML, "basic indentation");
22 is(p('hi',pre('there'),'frog'), <<HTML, "<pre> tags");
24 hi <pre>there</pre> frog
28 is(h1({-align=>'CENTER'},'fred'), <<HTML, "open/close tag with attribute");
34 is(h1({-align=>undef},'fred'), <<HTML,"open/close tag with orphan attribute");
40 is(h1({-align=>'CENTER'},['fred','agnes']), <<HTML, "distributive tag with attribute");
49 is(p('hi',a({-href=>'frog'},'there'),'frog'), <<HTML, "as-is");
51 hi <a href="frog">there</a> frog
55 is(p([ qw( hi there frog ) ] ), <<HTML, "array-reference");
67 is(p(p(p('hi'), 'there' ), 'frog'), <<HTML, "nested tags");
79 is(table(TR(td(table(TR(td('hi', 'there', 'frog')))))), <<HTML, "nested as-is tags");
84 <td>hi there frog</td>
91 is(table(TR(td(table(TR(td( [ qw( hi there frog ) ])))))), <<HTML, "nested as-is array-reference");
96 <td>hi</td><td>there</td><td>frog</td>
103 $CGI::Pretty::INDENT = $CGI::Pretty::LINEBREAK = "";
105 is(h1(), '<h1 />',"single tag (pretty turned off)");
106 is(h1('fred'), '<h1>fred</h1>',"open/close tag (pretty turned off)");
107 is(h1('fred','agnes','maura'), '<h1>fred agnes maura</h1>',"open/close tag multiple (pretty turned off)");
108 is(h1({-align=>'CENTER'},'fred'), '<h1 align="CENTER">fred</h1>',"open/close tag with attribute (pretty turned off)");
109 is(h1({-align=>undef},'fred'), '<h1 align>fred</h1>',"open/close tag with orphan attribute (pretty turned off)");
110 is(h1({-align=>'CENTER'},['fred','agnes']), '<h1 align="CENTER">fred</h1> <h1 align="CENTER">agnes</h1>',
111 "distributive tag with attribute (pretty turned off)");