dougm       01/11/06 20:04:14

  Added:       t/modperl getc.t
               t/response/TestModperl getc.pm
  Log:
  add test for GETC
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/modperl/getc.t
  
  Index: getc.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  plan tests => 2, \&have_lwp;
  
  my $location = "/TestModperl::getc";
  
  my $expect = join '', 'a'..'Z';
  
  my $str = POST_BODY $location, content => $expect;
  
  ok $str;
  
  ok t_cmp($expect, $str, 'getc');
  
  
  
  
  1.1                  modperl-2.0/t/response/TestModperl/getc.pm
  
  Index: getc.pm
  ===================================================================
  package TestModperl::getc;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  
  sub handler {
      my $r = shift;
  
      tie *STDIN, $r unless tied *STDIN;
  
      while (my $c = getc) {
          die "got more than 1 char" unless length($c) == 1;
          $r->puts($c);
      }
  
      Apache::OK;
  }
  
  1;
  
  
  


Reply via email to