randyk 2004/07/07 21:52:06
Modified: t/apache constants.t discard_rbody.t post.t scanhdrs.t scanhdrs2.t send_cgi_header.t t/response/TestApache conftree.pm subprocess.pm util.pm Log: swap order of arguments passed to t_cmp in t/apache/ tests to use new ($received, $expected, $comment) syntax. Revision Changes Path 1.10 +10 -10 modperl-2.0/t/apache/constants.t Index: constants.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/apache/constants.t,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- constants.t 25 Nov 2003 18:41:47 -0000 1.9 +++ constants.t 8 Jul 2004 04:52:06 -0000 1.10 @@ -19,24 +19,24 @@ plan tests => 17; -ok t_cmp(302, REDIRECT, 'REDIRECT'); +ok t_cmp(REDIRECT, 302, 'REDIRECT'); -ok t_cmp(401, AUTH_REQUIRED, 'AUTH_REQUIRED'); +ok t_cmp(AUTH_REQUIRED, 401, 'AUTH_REQUIRED'); -ok t_cmp(0, OK, 'OK'); +ok t_cmp(OK, 0, 'OK'); -ok t_cmp(0, Apache::OK, 'Apache::OK'); +ok t_cmp(Apache::OK, 0, 'Apache::OK'); -ok t_cmp(-1, Apache::DECLINED, 'Apache::DECLINED'); +ok t_cmp(Apache::DECLINED, -1, 'Apache::DECLINED'); -ok t_cmp(410, Apache::HTTP_GONE, 'Apache::HTTP_GONE'); +ok t_cmp(Apache::HTTP_GONE, 410, 'Apache::HTTP_GONE'); -ok t_cmp('httpd/unix-directory', - Apache::DIR_MAGIC_TYPE, +ok t_cmp(Apache::DIR_MAGIC_TYPE, + 'httpd/unix-directory', 'Apache::DIR_MAGIC_TYPE'); -ok t_cmp(9, - Apache::MPMQ_MAX_SPARE_DAEMONS, +ok t_cmp(Apache::MPMQ_MAX_SPARE_DAEMONS, + 9, 'Apache::MPMQ_MAX_SPARE_DAEMONS'); # the rest of the tests don't fit into the t_cmp() meme 1.2 +1 -1 modperl-2.0/t/apache/discard_rbody.t Index: discard_rbody.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/apache/discard_rbody.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- discard_rbody.t 23 Sep 2003 02:36:45 -0000 1.1 +++ discard_rbody.t 8 Jul 2004 04:52:06 -0000 1.2 @@ -12,6 +12,6 @@ for my $test (qw(none partial all)) { my $received = POST_BODY "$location?$test", content => $content; - ok t_cmp($test, $received, "data consumption: $test"); + ok t_cmp($received, $test, "data consumption: $test"); } 1.6 +2 -2 modperl-2.0/t/apache/post.t Index: post.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/apache/post.t,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- post.t 18 Apr 2003 06:18:55 -0000 1.5 +++ post.t 8 Jul 2004 04:52:06 -0000 1.6 @@ -20,6 +20,6 @@ my $data = join '&', map { "$_=$data{$_}" } keys %data; $str = POST_BODY $location, content => $data; -ok t_cmp(join(':', length($data), $data), - $str, +ok t_cmp($str, + join(':', length($data), $data), "POST"); 1.8 +4 -4 modperl-2.0/t/apache/scanhdrs.t Index: scanhdrs.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/apache/scanhdrs.t,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- scanhdrs.t 3 Jul 2004 18:45:45 -0000 1.7 +++ scanhdrs.t 8 Jul 2004 04:52:06 -0000 1.8 @@ -16,12 +16,12 @@ ok t_cmp($res->content, qr/^ok 1$/m); -ok t_cmp('text/test-output', - $res->header('Content-Type'), +ok t_cmp($res->header('Content-Type'), + 'text/test-output', "standard header"); -ok t_cmp($module, - $res->header('X-Perl-Module'), +ok t_cmp($res->header('X-Perl-Module'), + $module, "custom header"); ok t_cmp($res->message, qr/beer/); 1.6 +4 -4 modperl-2.0/t/apache/scanhdrs2.t Index: scanhdrs2.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/apache/scanhdrs2.t,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- scanhdrs2.t 3 Jul 2004 18:45:45 -0000 1.5 +++ scanhdrs2.t 8 Jul 2004 04:52:06 -0000 1.6 @@ -14,20 +14,20 @@ my $res = GET "$location?$redirect", redirect_ok => 0; -ok t_cmp($redirect, $res->header('Location')||'', +ok t_cmp($res->header('Location')||'', $redirect, "Location header"); -ok t_cmp(302, $res->code, +ok t_cmp($res->code, 302, "status == 302"); $redirect = '/index.html'; $res = GET "$location?$redirect", redirect_ok => 0; -ok t_cmp(1, !$res->header('Location'), +ok t_cmp(!$res->header('Location'), 1, "no Location header"); -ok t_cmp(200, $res->code, +ok t_cmp($res->code, 200, "status == 200"); ok t_cmp($res->content, qr{welcome to}, 1.4 +8 -8 modperl-2.0/t/apache/send_cgi_header.t Index: send_cgi_header.t =================================================================== RCS file: /home/cvs/modperl-2.0/t/apache/send_cgi_header.t,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- send_cgi_header.t 3 Mar 2004 06:03:10 -0000 1.3 +++ send_cgi_header.t 8 Jul 2004 04:52:06 -0000 1.4 @@ -10,22 +10,22 @@ my $location = "/TestApache__send_cgi_header"; my $res = GET $location; -ok t_cmp('X-Bar', - $res->header('X-Foo'), +ok t_cmp($res->header('X-Foo'), + 'X-Bar', "header test"); -ok t_cmp('Bad Programmer, No cookie!', - $res->header('Set-Cookie'), +ok t_cmp($res->header('Set-Cookie'), + 'Bad Programmer, No cookie!', "header test2"); my $expected = "\0\0This not the end of the world\0\0\n"; my $received = $res->content; -ok t_cmp(length($expected), - length($received), +ok t_cmp(length($received), + length($expected), "body length test"); # \000 aren't seen when printed -ok t_cmp($expected, - $received, +ok t_cmp($received, + $expected, "body content test"); 1.11 +4 -4 modperl-2.0/t/response/TestApache/conftree.pm Index: conftree.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestApache/conftree.pm,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- conftree.pm 29 Mar 2004 22:52:46 -0000 1.10 +++ conftree.pm 8 Jul 2004 04:52:06 -0000 1.11 @@ -29,15 +29,15 @@ my $hostname_lookups = $tree->lookup('HostnameLookups'); - ok t_cmp("Off", $hostname_lookups); + ok t_cmp($hostname_lookups, "Off"); my $documentroot = $tree->lookup('DocumentRoot'); - ok t_cmp('HASH' , ref($tree->as_hash()), 'as_hash'); + ok t_cmp(ref($tree->as_hash()), 'HASH', 'as_hash'); - ok t_cmp(qq("$vars->{documentroot}"), $documentroot); + ok t_cmp($documentroot, qq("$vars->{documentroot}")); - ok t_cmp(qq("$vars->{documentroot}"), $tree->lookup("DocumentRoot")); + ok t_cmp($tree->lookup("DocumentRoot"), qq("$vars->{documentroot}")); #XXX: This test isn't so good, but its quite problematic to try #and _really_ compare $cfg and $tree... 1.15 +11 -11 modperl-2.0/t/response/TestApache/subprocess.pm Index: subprocess.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestApache/subprocess.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- subprocess.pm 5 Jun 2003 14:49:37 -0000 1.14 +++ subprocess.pm 8 Jul 2004 04:52:06 -0000 1.15 @@ -54,8 +54,8 @@ my $out_fh = Apache::SubProcess::spawn_proc_prog($r, $perl, [$script, @argv]); my $output = read_data($out_fh); - ok t_cmp([EMAIL PROTECTED], - [split / /, $output], + ok t_cmp([split / /, $output], + [EMAIL PROTECTED], "passing ARGV" ); } @@ -67,8 +67,8 @@ $r->subprocess_env->set(SubProcess => $value); my $out_fh = Apache::SubProcess::spawn_proc_prog($r, $perl, [$script]); my $output = read_data($out_fh); - ok t_cmp($value, - $output, + ok t_cmp($output, + $value, "passing env via subprocess_env" ); } @@ -81,8 +81,8 @@ Apache::SubProcess::spawn_proc_prog($r, $perl, [$script]); print $in_fh $value; (my $output = read_data($out_fh)) =~ s/[\r\n]{1,2}/\r\n/; - ok t_cmp($value, - $output, + ok t_cmp($output, + $value, "testing subproc's stdin -> stdout + list context" ); } @@ -95,8 +95,8 @@ Apache::SubProcess::spawn_proc_prog($r, $perl, [$script]); print $in_fh $value; (my $output = read_data($err_fh)) =~ s/[\r\n]{1,2}/\r\n/; - ok t_cmp($value, - $output, + ok t_cmp($output, + $value, "testing subproc's stdin -> stderr + list context" ); } @@ -106,20 +106,20 @@ # these are wannabe's # ok t_cmp( -# Apache::SUCCESS, # Apache::SubProcess::spawn_proc_sub($r, $sub, [EMAIL PROTECTED]), +# Apache::SUCCESS, # "spawn a subprocess and run a subroutine in it" # ); # ok t_cmp( -# Apache::SUCCESS, # Apache::SubProcess::spawn_thread_prog($r, $command, [EMAIL PROTECTED]), +# Apache::SUCCESS, # "spawn thread and run a program in it" # ); # ok t_cmp( -# Apache::SUCCESS, # Apache::SubProcess::spawn_thread_sub($r, $sub, [EMAIL PROTECTED]), +# Apache::SUCCESS, # "spawn thread and run a subroutine in it" # ); 1.5 +7 -7 modperl-2.0/t/response/TestApache/util.pm Index: util.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/response/TestApache/util.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- util.pm 3 Jul 2004 18:45:46 -0000 1.4 +++ util.pm 8 Jul 2004 04:52:06 -0000 1.5 @@ -35,20 +35,20 @@ my $fmtdate; $fmtdate = Apache::Util::ht_time($r->pool); - time_cmp($time, $fmtdate, + time_cmp($fmtdate, $time, 'Apache::Util::ht_time($pool)', 0); $fmtdate = Apache::Util::ht_time($r->pool, $time); - time_cmp($time, $fmtdate, + time_cmp($fmtdate, $time, 'Apache::Util::ht_time($pool, $time)', 1); $fmtdate = Apache::Util::ht_time($r->pool, $time, $fmt); - time_cmp($time, $fmtdate, + time_cmp($fmtdate, $time, 'Apache::Util::ht_time($pool, $time, $fmt)', 1); my $gmt = 0; $fmtdate = Apache::Util::ht_time($r->pool, $time, $fmt, $gmt); - time_cmp($time, $fmtdate, + time_cmp($fmtdate, $time, 'Apache::Util::ht_time($pool, $time, $fmt, $gmt)', 0); } @@ -57,15 +57,15 @@ my $fmtdate_ptn = qr/^\w+, \d\d \w+ \d\d\d\d \d\d:\d\d:\d\d/; sub time_cmp { - my($time, $fmtdate, $comment, $exact_match) = @_; + my($fmtdate, $time, $comment, $exact_match) = @_; if ($parse_time_ok && $exact_match) { my $ptime = APR::Date::parse_http($fmtdate); t_debug "fmtdate: $fmtdate"; - ok t_cmp($time, $ptime, $comment); + ok t_cmp($ptime, $time, $comment); } else { - ok t_cmp($fmtdate, $fmtdate_ptn, $comment); + ok t_cmp($fmtdate_ptn, $fmtdate, $comment); } }