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