#!/usr/bin/perl -Tw use Test::More tests => 16; use warnings; $^W = 1; use strict; use utf8; BEGIN { chdir 't' if -d 't'; } use_ok( 'IPC::Open3' ); use_ok( 'RayApp::CGI' ); my ($out, $err); local (*WRTFH, *RDFH, *ERRFH); delete @ENV{'PATH', 'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; undef $/; my $PERL = $^X; $PERL =~ /(.+)/ and $PERL = $1; my $pid; $ENV{PATH_TRANSLATED} = 'script1.xml'; $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, $PERL, '-Mblib', '-MRayApp::CGI', '-e', 'RayApp::CGI::handler()'); close WRTFH; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the output of XML serialization"); Pragma: no-cache Cache-control: no-cache Status: 200 Content-Type: text/xml Peter Wolf Brian Fox Leslie Child Barbara Bailey Russell King Michael Johnson Michael Shell Tim Jasmine 1523 8234B Šílené laně EOF $err = '' if not defined $err; is($err, '', "Check the error output"); $ENV{PATH_TRANSLATED} = 'script1.html'; $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, $PERL, '-I../../lib', '-MRayApp::CGI', '-e', 'RayApp::CGI::handler()'); close WRTFH; binmode RDFH, ':utf8'; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the output of HTML serialization"); Pragma: no-cache Cache-control: no-cache Status: 200 Content-Type: text/html; charset=UTF-8

A list of students

Study program: Šílené laně (8234B)

  • Wolf Peter
  • Fox Brian
  • Child Leslie
  • Bailey Barbara
  • King Russell
  • Johnson Michael
  • Shell Michael
  • Jasmine Tim
EOF $err = '' if not defined $err; is($err, '', "Check the error output"); $ENV{PATH_TRANSLATED} = 'script1.html'; $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, '../../bin/rayapp_cgi_wrapper'); close WRTFH; binmode RDFH, ':utf8'; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the output of HTML serialization"); Pragma: no-cache Cache-control: no-cache Status: 200 Content-Type: text/html; charset=UTF-8

A list of students

Study program: Šílené laně (8234B)

  • Wolf Peter
  • Fox Brian
  • Child Leslie
  • Bailey Barbara
  • King Russell
  • Johnson Michael
  • Shell Michael
  • Jasmine Tim
EOF $err = '' if not defined $err; is($err, '', "Check the error output"); $ENV{PATH_TRANSLATED} = 'script1.html'; $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, $PERL, '-I../../lib', '-MRayApp::CGIWrapper'); close WRTFH; binmode RDFH, ':utf8'; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the output of HTML serialization"); Pragma: no-cache Cache-control: no-cache Status: 200 Content-Type: text/html; charset=UTF-8

A list of students

Study program: Šílené laně (8234B)

  • Wolf Peter
  • Fox Brian
  • Child Leslie
  • Bailey Barbara
  • King Russell
  • Johnson Michael
  • Shell Michael
  • Jasmine Tim
EOF $err = '' if not defined $err; is($err, '', "Check the error output"); $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, $PERL, '-I../../lib', '-MRayApp::CGI', '-e', 'RayApp::CGI::handler', 'script1.xml'); close WRTFH; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the XML output for target set on command line"); Pragma: no-cache Cache-control: no-cache Status: 200 Content-Type: text/xml Peter Wolf Brian Fox Leslie Child Barbara Bailey Russell King Michael Johnson Michael Shell Tim Jasmine 1523 8234B Šílené laně EOF $err = '' if not defined $err; is($err, '', "No error output"); $ENV{PATH_TRANSLATED} = 'not_exist.html'; $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, $PERL, '-I../../lib', '-MRayApp::CGIWrapper'); close WRTFH; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the 404 message"); Status: 404 Content-Type: text/plain The requested URL was not found on this server. EOF $err = '' if not defined $err; is($err, <<'EOF', "Check the error output"); RayApp::CGI: filename [not_exist.html] no DSD found EOF $ENV{PATH_TRANSLATED} = 'not_exist.html'; $pid = IPC::Open3::open3(\*WRTFH, \*RDFH, \*ERRFH, $PERL, '-I../../lib', '-MRayApp::CGIWrapper'); close WRTFH; $out = ; close RDFH; $err = ; close ERRFH; is($out, <<'EOF', "Check the 404 message"); Status: 404 Content-Type: text/plain The requested URL was not found on this server. EOF $err = '' if not defined $err; is($err, <<'EOF', "Check the error output"); RayApp::CGI: filename [not_exist.html] no DSD found EOF