You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by ra...@apache.org on 2004/07/09 17:12:56 UTC

cvs commit: modperl-2.0/t/response/TestCompat apache.pm apache_file.pm apache_table.pm apache_uri.pm apache_util.pm request.pm

randyk      2004/07/09 08:12:56

  Modified:    t/compat request_body.t
               t/response/TestCompat apache.pm apache_file.pm
                        apache_table.pm apache_uri.pm apache_util.pm
                        request.pm
  Log:
  swap order of args to t_cmp in t/compat tests to use new
  ($received, $expected, $comment) syntax.
  
  Revision  Changes    Path
  1.4       +5 -5      modperl-2.0/t/compat/request_body.t
  
  Index: request_body.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/compat/request_body.t,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- request_body.t	18 Apr 2003 06:18:55 -0000	1.3
  +++ request_body.t	9 Jul 2004 15:12:56 -0000	1.4
  @@ -14,8 +14,8 @@
   {
       my @data = (test => 'content-type');
       ok t_cmp(
  -        "text/plain",
           HEAD(query(@data))->content_type(),
  +        "text/plain",
           q{$r->send_http_header('text/plain')}
           );
   }
  @@ -25,8 +25,8 @@
       my @data = (test => 'content');
       my $content = join '=', @data;
       ok t_cmp(
  -        "@data",
           POST_BODY($location, content => $content),
  +        "@data",
           q{$r->content via POST}
           );
   }
  @@ -35,8 +35,8 @@
   {
       my @data = (test => 'args');
       ok t_cmp(
  -        "@data",
           GET_BODY(query(@data)),
  +        "@data",
           q{$r->Apache::args}
           );
   }
  @@ -48,8 +48,8 @@
           body => '%DC%DC+%EC%2E+%D6%D6+%D6%2F',
       );
       ok t_cmp(
  -        $data{body},
           GET_BODY(query(%data)),
  +        $data{body},
           q{decoding}
          );
   }
  @@ -63,8 +63,8 @@
          );
       my $content = join '=', %data;
       ok t_cmp(
  -        length($data{body}),
           POST_BODY($location, content => $content),
  +        length($data{body}),
           q{big POST}
          );
   }
  
  
  
  1.13      +22 -22    modperl-2.0/t/response/TestCompat/apache.pm
  
  Index: apache.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache.pm,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- apache.pm	2 Jun 2004 02:13:24 -0000	1.12
  +++ apache.pm	9 Jul 2004 15:12:56 -0000	1.13
  @@ -23,20 +23,20 @@
   
       ### Apache-> tests
       my $fh = Apache->gensym;
  -    ok t_cmp('GLOB', ref($fh), "Apache->gensym");
  +    ok t_cmp(ref($fh), 'GLOB', "Apache->gensym");
   
  -    ok t_cmp(1, Apache->module('mod_perl.c'),
  +    ok t_cmp(Apache->module('mod_perl.c'), 1,
                "Apache::module('mod_perl.c')");
  -    ok t_cmp(0, Apache->module('mod_ne_exists.c'),
  +    ok t_cmp(Apache->module('mod_ne_exists.c'), 0,
                "Apache::module('mod_ne_exists.c')");
   
   
  -    ok t_cmp(Apache::exists_config_define('MODPERL2'),
  -             Apache->define('MODPERL2'),
  +    ok t_cmp(Apache->define('MODPERL2'),
  +             Apache::exists_config_define('MODPERL2'),
                'Apache->define');
   
  -    ok t_cmp('PerlResponseHandler',
  -             Apache::current_callback(),
  +    ok t_cmp(Apache::current_callback(),
  +             'PerlResponseHandler',
                'inside PerlResponseHandler');
   
       t_server_log_error_is_expected();
  @@ -44,48 +44,48 @@
       ok 1;
   
       # explicitly imported
  -    ok t_cmp("httpd/unix-directory", DIR_MAGIC_TYPE,
  +    ok t_cmp(DIR_MAGIC_TYPE, "httpd/unix-directory",
                'DIR_MAGIC_TYPE');
   
       # :response is ignored, but is now aliased in :common
  -    ok t_cmp("302", REDIRECT,
  +    ok t_cmp(REDIRECT, "302",
                'REDIRECT');
   
       # from :common
  -    ok t_cmp("401", AUTH_REQUIRED,
  +    ok t_cmp(AUTH_REQUIRED, "401",
                'AUTH_REQUIRED');
   
  -    ok t_cmp("0", OK,
  +    ok t_cmp(OK, "0",
                'OK');
   
       my $admin = $r->server->server_admin;
       Apache->httpd_conf('ServerAdmin foo@bar.com');
  -    ok t_cmp('foo@bar.com', $r->server->server_admin,
  +    ok t_cmp($r->server->server_admin, 'foo@bar.com',
                'Apache->httpd_conf');
       $r->server->server_admin($admin);
   
  -    ok t_filepath_cmp(canonpath($Apache::Server::CWD),
  -                      canonpath(Apache::Test::config()->{vars}->{serverroot}),
  +    ok t_filepath_cmp(canonpath(Apache::Test::config()->{vars}->{serverroot}),
  +                      canonpath($Apache::Server::CWD),
                         '$Apache::Server::CWD');
   
  -    ok t_filepath_cmp(canonpath($Apache::Server::CWD),
  -                      canonpath($r->server_root_relative),
  +    ok t_filepath_cmp(canonpath($r->server_root_relative),
  +                      canonpath($Apache::Server::CWD),
                         '$r->server_root_relative()');
   
  -    ok t_filepath_cmp(catfile($Apache::Server::CWD, 'conf'),
  -                      canonpath($r->server_root_relative('conf')),
  +    ok t_filepath_cmp(canonpath($r->server_root_relative('conf')),
  +                      catfile($Apache::Server::CWD, 'conf'),
                         "\$r->server_root_relative('conf')");
   
       # Apache->server_root_relative
       {
           Apache::compat::override_mp2_api('Apache::server_root_relative');
   
  -        ok t_filepath_cmp(catfile($Apache::Server::CWD, 'conf'),
  -                          canonpath(Apache->server_root_relative('conf')),
  +        ok t_filepath_cmp(canonpath(Apache->server_root_relative('conf')),
  +                          catfile($Apache::Server::CWD, 'conf'),
                             "Apache->server_root_relative('conf')");
   
  -        ok t_filepath_cmp(canonpath($Apache::Server::CWD),
  -                          canonpath(Apache->server_root_relative),
  +        ok t_filepath_cmp(canonpath(Apache->server_root_relative),
  +                          canonpath($Apache::Server::CWD),
                             'Apache->server_root_relative()');
   
           Apache::compat::restore_mp2_api('Apache::server_root_relative');
  
  
  
  1.3       +10 -10    modperl-2.0/t/response/TestCompat/apache_file.pm
  
  Index: apache_file.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_file.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apache_file.pm	12 Apr 2004 21:52:10 -0000	1.2
  +++ apache_file.pm	9 Jul 2004 15:12:56 -0000	1.3
  @@ -74,20 +74,20 @@
       my $write = "test $$";
       print $tmpfh $write;
       seek $tmpfh, 0, 0;
  -    ok t_cmp($write, <$tmpfh>, "write/read from tmpfile");
  +    ok t_cmp(<$tmpfh>, $write, "write/read from tmpfile");
   
  -    ok t_cmp(Apache::OK,
  -             $r->discard_request_body,
  +    ok t_cmp($r->discard_request_body,
  +             Apache::OK,
                "\$r->discard_request_body");
   
  -    ok t_cmp(Apache::OK,
  -             $r->meets_conditions,
  +    ok t_cmp($r->meets_conditions,
  +             Apache::OK,
                "\$r->meets_conditions");
   
       my $csize = 10;
       $r->set_content_length($csize);
  -    ok t_cmp($csize,
  -             $r->headers_out->{"Content-length"},
  +    ok t_cmp($r->headers_out->{"Content-length"},
  +             $csize,
                "\$r->set_content_length($csize) w/ setting explicit size");
   
   #    #$r->set_content_length();
  @@ -109,14 +109,14 @@
   
       my $time = time;
       $r->update_mtime($time);
  -    ok t_cmp($time, $r->mtime, "\$r->update_mtime(\$time)/\$r->mtime");
  +    ok t_cmp($r->mtime, $time, "\$r->update_mtime(\$time)/\$r->mtime");
   
       # $r->set_last_modified
       $r->set_last_modified();
  -    ok t_cmp($time, $r->mtime, "\$r->set_last_modified()");
  +    ok t_cmp($r->mtime, $time, "\$r->set_last_modified()");
   
       $r->set_last_modified($time);
  -    ok t_cmp($time, $r->mtime, "\$r->set_last_modified(\$time)");
  +    ok t_cmp($r->mtime, $time, "\$r->set_last_modified(\$time)");
   
       OK;
   }
  
  
  
  1.2       +2 -2      modperl-2.0/t/response/TestCompat/apache_table.pm
  
  Index: apache_table.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_table.pm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- apache_table.pm	15 Aug 2002 09:35:11 -0000	1.1
  +++ apache_table.pm	9 Jul 2004 15:12:56 -0000	1.2
  @@ -23,9 +23,9 @@
       my $t = Apache::Table->new($r);
       my $t_class = ref $t;
   
  -    ok t_cmp('APR::Table', $t_class, "Apache::Table->new");
  +    ok t_cmp($t_class, 'APR::Table', "Apache::Table->new");
   
  -    ok t_cmp(!$r->main, $r->is_main,
  +    ok t_cmp($r->is_main, !$r->main,
                '$r->is_main');
   
       OK;
  
  
  
  1.5       +1 -1      modperl-2.0/t/response/TestCompat/apache_uri.pm
  
  Index: apache_uri.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_uri.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apache_uri.pm	29 May 2004 07:34:16 -0000	1.4
  +++ apache_uri.pm	9 Jul 2004 15:12:56 -0000	1.5
  @@ -48,7 +48,7 @@
           $parsed->hostname($r->get_server_name);
           $parsed->port($r->get_server_port);
           #$parsed->scheme('http'); # compat defaults to 'http' like apache-1.3 did
  -        ok t_cmp($r->construct_url, $parsed->unparse);
  +        ok t_cmp($parsed->unparse, $r->construct_url);
           Apache::compat::restore_mp2_api('APR::URI::unparse');
       }
   
  
  
  
  1.6       +10 -10    modperl-2.0/t/response/TestCompat/apache_util.pm
  
  Index: apache_util.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/apache_util.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apache_util.pm	9 Feb 2004 19:25:01 -0000	1.5
  +++ apache_util.pm	9 Jul 2004 15:12:56 -0000	1.6
  @@ -55,22 +55,22 @@
       $uri = Apache::Util::escape_uri($uri);
       $uri2 = Apache::Util::escape_path($uri2, $r->pool);
   
  -    ok t_cmp($esc_uri, $uri, "Apache::Util::escape_uri");
  -    ok t_cmp($esc_uri, $uri2, "Apache::Util::escape_path");
  +    ok t_cmp($uri, $esc_uri, "Apache::Util::escape_uri");
  +    ok t_cmp($uri2, $esc_uri, "Apache::Util::escape_path");
   
  -    ok t_cmp(Apache::URI::unescape_url($uri),
  -             Apache::Util::unescape_uri($uri2),
  +    ok t_cmp(Apache::Util::unescape_uri($uri2),
  +             Apache::URI::unescape_url($uri),
                "Apache::URI::unescape_uri vs Apache::Util::unescape_uri");
   
  -    ok t_cmp($uri,
  -             $uri2,
  +    ok t_cmp($uri2,
  +             $uri,
                "Apache::URI::unescape_uri vs Apache::Util::unescape_uri");
   
       # escape_html()
       my $html = '<p>"hi"&foo</p>';
       my $esc_html = '&lt;p&gt;&quot;hi&quot;&amp;foo&lt;/p&gt;';
   
  -    ok t_cmp($esc_html, Apache::Util::escape_html($html),
  +    ok t_cmp(Apache::Util::escape_html($html), $esc_html,
                "Apache::Util::escape_html");
   
   
  @@ -84,14 +84,14 @@
   
       if ($parse_time_ok) {
           my $ptime = Apache::Util::parsedate($fmtdate);
  -        ok t_cmp($time, $ptime, "Apache::Util::parsedate");
  +        ok t_cmp($ptime, $time, "Apache::Util::parsedate");
       }
   
       if ($crypt_ok) {
           # not all platforms support C-level crypt
           my $hash = "aX9eP53k4DGfU";
  -        ok t_cmp(1, Apache::Util::validate_password("dougm", $hash));
  -        ok t_cmp(0, Apache::Util::validate_password("mguod", $hash));
  +        ok t_cmp(Apache::Util::validate_password("dougm", $hash), 1);
  +        ok t_cmp(Apache::Util::validate_password("mguod", $hash), 0);
       }
   
       OK;
  
  
  
  1.5       +10 -10    modperl-2.0/t/response/TestCompat/request.pm
  
  Index: request.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestCompat/request.pm,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- request.pm	17 Dec 2003 18:55:25 -0000	1.4
  +++ request.pm	9 Jul 2004 15:12:56 -0000	1.5
  @@ -40,8 +40,8 @@
                       $r->$sub_good->set($key, $key x 2);
                   }
   
  -                ok t_cmp($r->$sub_good->get($key),
  -                         $r->$sub_test($key),
  +                ok t_cmp($r->$sub_test($key),
  +                         $r->$sub_good->get($key),
                            "\$r->$sub_test in scalar context");
               }
   
  @@ -49,8 +49,8 @@
               {
                   my @exp = qw(foo bar);
                   $r->$sub_good->add($key => $_) for @exp;
  -                ok t_cmp(\@exp,
  -                         [ $r->$sub_test($key) ],
  +                ok t_cmp([ $r->$sub_test($key) ],
  +                         \@exp,
                            "\$r->$sub_test in list context");
               }
   
  @@ -59,7 +59,7 @@
                   my $exp = $key x 2;
                   $r->$sub_test($key => $exp);
                   my $got = $r->$sub_test($key);
  -                ok t_cmp($exp, $got, "\$r->$sub_test set()");
  +                ok t_cmp($got, $exp, "\$r->$sub_test set()");
               }
   
               # unset
  @@ -67,7 +67,7 @@
                   my $exp = undef;
                   $r->$sub_test($key => $exp);
                   my $got = $r->$sub_test($key);
  -                ok t_cmp($exp, $got, "\$r->$sub_test unset()");
  +                ok t_cmp($got, $exp, "\$r->$sub_test unset()");
               }
           }
       }
  @@ -82,8 +82,8 @@
           {
               my $val = 'ok';
               $r->notes($key => $val);
  -            ok t_cmp($r->notes->get($key), $val, "\$r->notes->get(\$key)");
  -            ok t_cmp($r->notes($key),      $val, "\$r->notes(\$key)");
  +            ok t_cmp($val, $r->notes->get($key), "\$r->notes->get(\$key)");
  +            ok t_cmp($val, $r->notes($key),      "\$r->notes(\$key)");
           }
   
           # unset
  @@ -91,14 +91,14 @@
               my $exp = undef;
               $r->notes($key => $exp);
               my $got = $r->notes($key);
  -            ok t_cmp($exp, $got, "\$r->notes unset()");
  +            ok t_cmp($got, $exp, "\$r->notes unset()");
           }
   
           # get/set list context
           {
               my @exp = qw(foo bar);
               $r->notes->add($key => $_) for @exp;
  -            ok t_cmp(\@exp, [ $r->notes($key) ], "\$r->notes in list context");
  +            ok t_cmp([ $r->notes($key) ], \@exp, "\$r->notes in list context");
           }
   
           # restore the real 2.0 notes() method, now that we are done