dougm       2002/10/07 13:44:32

  Modified:    t/conf   extra.conf.in
  Added:       t/htdocs/includes-registry test.spl
               t/modules include2.t
  Log:
  test for mod_include parsing of mod_perl script output
  
  Revision  Changes    Path
  1.4       +2 -1      modperl-2.0/t/conf/extra.conf.in
  
  Index: extra.conf.in
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/conf/extra.conf.in,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- extra.conf.in     9 Apr 2002 03:38:02 -0000       1.3
  +++ extra.conf.in     7 Oct 2002 20:44:31 -0000       1.4
  @@ -9,7 +9,8 @@
   
   <Directory @ServerRoot@/htdocs/includes-registry>
       SetHandler perl-script
  -    Options +ExecCGI
  +    Options +ExecCGI +IncludesNoExec
       PerlResponseHandler ModPerl::Registry
       PerlOptions +ParseHeaders +GlobalRequest
  +    AddOutputFilter INCLUDES .spl
   </Directory>
  
  
  
  1.1                  modperl-2.0/t/htdocs/includes-registry/test.spl
  
  Index: test.spl
  ===================================================================
  use strict;
  
  #XXX: this test needs to be more robust.
  #various output buffers spread across multiple prints
  #more mod_include features mixed and checking that the output
  #is *exactly* what we expected, not just matching a few patterns.
  
  print "Content-type: text/html\n\n";
  
  my $r = shift;
  
  my $test_string = 'Perl-SSI';
  
  $r->subprocess_env->set(MY_TEST => $test_string);
  
  print <<EOF;
  Hello World from <!--#echo var="SERVER_ADMIN" --><br>
  Local date is <!--#echo var="DATE_LOCAL" --><br>
  Brought to you by <!--#echo var="MY_TEST" -->
  <!--#echo var="SERVER_SOFTWARE" -->
  <br>
  EOF
  
  
  
  
  1.1                  modperl-2.0/t/modules/include2.t
  
  Index: include2.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestRequest;
  use Apache::TestUtil;
  
  #test for mod_include parsing of mod_perl script output
  #XXX: needs to be more robust.  see t/htdocs/includes-registry/test.spl
  my @patterns = (
      'Perl-SSI', #MY_TEST
      'mod_perl', #SERVER_SOFTWARE
  );
  
  plan tests => 2 + @patterns, ['include'];
  
  my $location = "/includes-registry/test.spl";
  
  my($res, $str);
  
  $res = GET $location;
  
  ok $res->is_success;
  
  $str = $res->content;
  
  ok $str;
  
  for my $pat (@patterns) {
      ok t_cmp(qr{$pat}, $str, "/$pat/");
  }
  
  
  


Reply via email to