Update to CGI 2.70, from Lincoln Stein.
[p5sagit/p5-mst-13.2.git] / t / lib / cgi-pretty.t
1 #!/usr/local/bin/perl -w
2
3 # Test ability to retrieve HTTP request info
4 ######################### We start with some black magic to print on failure.
5 use lib '../blib/lib','../blib/arch';
6
7 BEGIN {$| = 1; print "1..5\n"; }
8 END {print "not ok 1\n" unless $loaded;}
9 use CGI::Pretty (':standard','-no_debug','*h3','start_table');
10 $loaded = 1;
11 print "ok 1\n";
12
13 ######################### End of black magic.
14
15 # util
16 sub test {
17     local($^W) = 0;
18     my($num, $true,$msg) = @_;
19     print($true ? "ok $num\n" : "not ok $num $msg\n");
20 }
21
22 # all the automatic tags
23 test(2,h1() eq '<h1>',"single tag");
24 test(3,ol(li('fred'),li('ethel')) eq "<ol>\n\t<li>\n\t\tfred\n\t</li>\n\t <li>\n\t\tethel\n\t</li>\n</ol>\n","basic indentation");
25 test(4,p('hi',pre('there'),'frog') eq 
26 '<p>
27         hi <pre>there</pre>
28          frog
29 </p>
30 ',"<pre> tags");
31 test(5,p('hi',a({-href=>'frog'},'there'),'frog') eq 
32 '<p>
33         hi <a href="frog">there</a>
34          frog
35 </p>
36 ',"as-is");