perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-docs/src/docs/general/testing testing.pod
Date Tue, 22 Apr 2003 04:25:52 GMT
stas        2003/04/21 21:25:52

  Modified:    src/docs/general/testing testing.pod
  Log:
  update the tutorial to use BODY_ASSERT macro...
  
  Revision  Changes    Path
  1.15      +16 -12    modperl-docs/src/docs/general/testing/testing.pod
  
  Index: testing.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/general/testing/testing.pod,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- testing.pod	22 Apr 2003 04:18:34 -0000	1.14
  +++ testing.pod	22 Apr 2003 04:25:51 -0000	1.15
  @@ -1167,22 +1167,15 @@
   side, that tells the testing framework that things went wrong. Without
   it the test will be skipped, and that's not what we want.
   
  -  use Apache::TestRequest 'GET';
  -  my $res = GET "/TestApache::write";
  -  if ($res->is_success) {
  -      print $res->content;
  -  }
  -  else {
  -      die "server side has failed (response code: ", $res->code, "),\n",
  -          "see t/logs/error_log for more details\n";
  -  }
  +  use Apache::TestRequest 'GET_BODY_ASSERT';
  +  print GET_BODY_ASSERT "/TestApache__write";
   
   As you can see the request URI is autogenerated from the response test
   name:
   
  -  $response_test =~ s|.*/([^/]+)/(.*).pm$|/$1::$2|;
  +  $response_test =~ s|.*/([^/]+)/(.*).pm$|/$1__$2|;
   
  -So I<t/response/TestApache/write.pm> becomes: I</TestApache::write>.
  +So I<t/response/TestApache/write.pm> becomes: I</TestApache__write>.
   
   Now a simple response test may look like this:
   
  @@ -1616,6 +1609,17 @@
     use Apache::TestUtil;
     ok GET_BODY('/index.html') eq $expect;
   
  +=item * BODY_ASSERT
  +
  +Same as the C<BODY> shortcut, but will assert if the request has
  +failed. So for example if the test's output is generated on the server
  +side, the client side may only need to print out what the server has
  +sent and we want it to report that the test has failed if the request
  +has failed:
  +
  +  use Apache::TestUtil;
  +  print GET_BODY_ASSERT "/foo"
  +
   =back
   
   =head2 Other Request Generation helpers
  @@ -2551,7 +2555,7 @@
     Apache::TestRequest::module($module);
     my $hostport = Apache::TestRequest::hostport($config);
     
  -  print GET_BODY "http://$hostport/test_foo";
  +  print GET_BODY_ASSERT "http://$hostport/test_foo";
   
   =head3 Running Pre-Configuration Code
   
  
  
  

Mime
View raw message