stas        2004/07/15 14:35:48

  Modified:    t/api    .cvsignore
  Added:       t/response/TestAPI request_subclass.pm request_util.pm
  Removed:     t/response/TestAPI r_subclass.pm rutil.pm
  Log:
  use consistent test file names
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/response/TestAPI/request_subclass.pm
  
  Index: request_subclass.pm
  ===================================================================
  package TestAPI::request_subclass;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::RequestRec ();
  our @ISA = qw(Apache::RequestRec);
  
  use Apache::Test;
  use Apache::TestRequest;
  
  use Apache::Const -compile => 'OK';
  
  sub new {
      my $class = shift;
      my $r = shift;
      bless { r => $r }, $class;
  }
  
  my $location = '/' . Apache::TestRequest::module2path(__PACKAGE__);
  
  sub handler {
      my $r = __PACKAGE__->new(shift);
  
      plan $r, tests => 5;
  
      eval { Apache->request; };
      ok $@;
  
      ok $r->uri eq $location;
  
      ok ((bless { r => $r })->uri eq $location); #nested
  
      eval { (bless {})->uri };
  
      ok $@ =~ /no .* key/;
  
      eval { (bless [])->uri };
  
      ok $@ =~ /unsupported/;
  
      Apache::OK;
  }
  
  1;
  __END__
  SetHandler perl-script
  PerlOptions -GlobalRequest
  
  
  
  1.1                  modperl-2.0/t/response/TestAPI/request_util.pm
  
  Index: request_util.pm
  ===================================================================
  package TestAPI::request_util;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::RequestUtil ();
  
  use Apache::Const -compile => 'OK';
  
  my %status_lines = (
     200 => '200 OK',
     400 => '400 Bad Request',
     500 => '500 Internal Server Error',
  );
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => (scalar keys %status_lines) + 8;
  
      ok $r->default_type;
  
      ok $r->document_root;
  
      ok $r->get_server_name;
  
      ok $r->get_server_port;
  
      ok $r->get_limit_req_body || 1;
  
      ok $r->is_initial_req;
  
      my $sig = $r->psignature("Here is the sig: ");
      t_debug $sig;
      ok $sig;
  
      my $pattern = 
          qr!(?s)GET /TestAPI__request_util.*Host:.*200 OK.*Content-Type:!;
  
      ok t_cmp($r->as_string,
               $pattern,
               "test for the request_line, host, status, and few " .
               "headers that should always be there");
  
      while (my($code, $line) = each %status_lines) {
          ok t_cmp(Apache::RequestUtil::get_status_line($code),
                   $line,
                   "Apache::RequestUtil::get_status_line($code)");
      }
  
      Apache::OK;
  }
  
  1;
  
  
  
  1.7       +2 -2      modperl-2.0/t/api/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/api/.cvsignore,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -u -r1.6 -r1.7
  --- .cvsignore        19 Jan 2004 18:35:26 -0000      1.6
  +++ .cvsignore        15 Jul 2004 21:35:48 -0000      1.7
  @@ -6,8 +6,8 @@
   module.t
   request_rec.t
   response.t
  -r_subclass.t
  -rutil.t
  +request_subclass.t
  +request_util.t
   sendfile.t
   server_rec.t
   server_util.t
  
  
  

Reply via email to