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