Commit | Line | Data |
6b4ac661 |
1 | #!/usr/local/bin/perl -w |
3d1a2ec4 |
2 | |
3 | # Test ability to retrieve HTTP request info |
4 | ######################### We start with some black magic to print on failure. |
6b4ac661 |
5 | use lib '../blib/lib','../blib/arch'; |
3d1a2ec4 |
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 |
6b4ac661 |
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"); |
3d1a2ec4 |
25 | test(4,p('hi',pre('there'),'frog') eq |
6b4ac661 |
26 | '<p> |
27 | hi <pre>there</pre> |
3d1a2ec4 |
28 | frog |
6b4ac661 |
29 | </p> |
3d1a2ec4 |
30 | ',"<pre> tags"); |
31 | test(5,p('hi',a({-href=>'frog'},'there'),'frog') eq |
6b4ac661 |
32 | '<p> |
33 | hi <a href="frog">there</a> |
3d1a2ec4 |
34 | frog |
6b4ac661 |
35 | </p> |
3d1a2ec4 |
36 | ',"as-is"); |