From: Peter Prymmer Date: Wed, 23 Aug 2000 13:58:31 +0000 (-0700) Subject: Missing parts of X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1e846b39a9b9b392d59f44058306b22437dc032a;p=p5sagit%2Fp5-mst-13.2.git Missing parts of Subject: [PATCH: 6789] some endl fixes for VMS wackiness Message-ID: p4raw-id: //depot/perl@6810 --- diff --git a/t/lib/cgi-html.t b/t/lib/cgi-html.t index a1ebe9e..a49388b 100755 --- a/t/lib/cgi-html.t +++ b/t/lib/cgi-html.t @@ -24,6 +24,14 @@ sub test { print($true ? "ok $num\n" : "not ok $num $msg\n"); } +my $CRLF = "\015\012"; +if ($^O eq 'VMS') { + $CRLF = "\n"; # via web server carriage is inserted automatically +} +if (ord("\t") != 9) { # EBCDIC? + $CRLF = "\r\n"; +} + # all the automatic tags test(2,h1() eq '

',"single tag"); test(3,h1('fred') eq '

fred

',"open/close tag"); @@ -37,10 +45,17 @@ test(7,h1({-align=>'CENTER'},['fred','agnes']) eq local($") = '-'; test(8,h1('fred','agnes','maura') eq '

fred-agnes-maura

',"open/close tag \$\" interpolation"); } -test(9,header() eq "Content-Type: text/html; charset=ISO-8859-1\015\012\015\012","header()"); -test(10,header(-type=>'image/gif') eq "Content-Type: image/gif\015\012\015\012","header()"); -test(11,header(-type=>'image/gif',-status=>'500 Sucks') eq "Status: 500 Sucks\015\012Content-Type: image/gif\015\012\015\012","header()"); -test(12,header(-nph=>1) eq "HTTP/1.0 200 OK\015\012Content-Type: text/html; charset=ISO-8859-1\015\012\015\012","header()"); +my $CRLF = "\015\012"; +if ($^O eq 'VMS') { + $CRLF = "\n"; # only on a webserver does a \r get inserted +} +if (ord("\t") != 9) { + $CRLF = "\r\n"; # EBCDIC CRLF +} +test(9,header() eq "Content-Type: text/html; charset=ISO-8859-1${CRLF}${CRLF}","header()"); +test(10,header(-type=>'image/gif') eq "Content-Type: image/gif${CRLF}${CRLF}","header()"); +test(11,header(-type=>'image/gif',-status=>'500 Sucks') eq "Status: 500 Sucks${CRLF}Content-Type: image/gif${CRLF}${CRLF}","header()"); +test(12,header(-nph=>1) eq "HTTP/1.0 200 OK${CRLF}Content-Type: text/html; charset=ISO-8859-1${CRLF}${CRLF}","header()"); test(13,start_html() ."\n" eq <