Commit | Line | Data |
6b4ac661 |
1 | #!/usr/local/bin/perl -w |
3d1a2ec4 |
2 | |
36e6c0f5 |
3 | BEGIN { |
4 | chdir('t') if -d 't'; |
20822f61 |
5 | @INC = '../lib'; |
36e6c0f5 |
6 | } |
7 | |
3d1a2ec4 |
8 | # Test ability to retrieve HTTP request info |
9 | ######################### We start with some black magic to print on failure. |
6b4ac661 |
10 | use lib '../blib/lib','../blib/arch'; |
3d1a2ec4 |
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 |
6b4ac661 |
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"); |
3d1a2ec4 |
30 | test(4,p('hi',pre('there'),'frog') eq |
6b4ac661 |
31 | '<p> |
32 | hi <pre>there</pre> |
3d1a2ec4 |
33 | frog |
6b4ac661 |
34 | </p> |
3d1a2ec4 |
35 | ',"<pre> tags"); |
36 | test(5,p('hi',a({-href=>'frog'},'there'),'frog') eq |
6b4ac661 |
37 | '<p> |
38 | hi <a href="frog">there</a> |
3d1a2ec4 |
39 | frog |
6b4ac661 |
40 | </p> |
3d1a2ec4 |
41 | ',"as-is"); |