This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make the test more portable.
[perl5.git] / t / lib / cgi-pretty.t
CommitLineData
3d1a2ec4
GS
1#!./perl
2
3# Test ability to retrieve HTTP request info
4######################### We start with some black magic to print on failure.
5BEGIN {
6 chdir 't' if -d 't';
7 unshift @INC, '../lib' if -d '../lib';
8}
9
10BEGIN {$| = 1; print "1..5\n"; }
11END {print "not ok 1\n" unless $loaded;}
12use CGI::Pretty (':standard','-no_debug','*h3','start_table');
13$loaded = 1;
14print "ok 1\n";
15
16######################### End of black magic.
17
18# util
19sub 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
26test(2,h1() eq '<H1>',"single tag");
27test(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");
28test(4,p('hi',pre('there'),'frog') eq
29'<P>
30 hi <PRE>there</PRE>
31 frog
32</P>
33',"<pre> tags");
34test(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");