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/15 17:29:12 UTC

cvs commit: modperl-2.0/t/response/TestAPR string.pm

randyk      2004/07/15 08:29:12

  Modified:    t/response/TestAPR string.pm
  Added:       t/apr-ext string.t
               t/lib/TestAPRlib string.pm
  Log:
  Reviewed by:	stas
  put common string tests under t/lib/TestAPRlib/, and call them
  from both t/apr/ and t/apr-ext/.
  
  Revision  Changes    Path
  1.1                  modperl-2.0/t/apr-ext/string.t
  
  Index: string.t
  ===================================================================
  use strict;
  use warnings FATAL => 'all';
  use Apache::Test;
  
  use TestAPRlib::string;
  
  plan tests => TestAPRlib::string::num_of_tests();
  
  TestAPRlib::string::test();
  
  
  
  1.1                  modperl-2.0/t/lib/TestAPRlib/string.pm
  
  Index: string.pm
  ===================================================================
  package TestAPRlib::string;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use APR::String ();
  
  my %size_string = (
      '-1'            => "  - ",
      0               => "  0 ",
      42              => " 42 ",
      42_000          => " 41K",
      42_000_000      => " 40M",
  #    42_000_000_000   => "40G",
  );
  
  sub num_of_tests {
      return scalar keys %size_string;
  }
  
  sub test {
  
      t_debug("size_string");
      while (my($k, $v) = each %size_string) {
          ok t_cmp($v, APR::String::format_size($k));
      }
  }
  
  1;
  
  
  
  1.3       +4 -16     modperl-2.0/t/response/TestAPR/string.pm
  
  Index: string.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPR/string.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- string.pm	11 Apr 2002 11:08:44 -0000	1.2
  +++ string.pm	15 Jul 2004 15:29:12 -0000	1.3
  @@ -4,30 +4,18 @@
   use warnings FATAL => 'all';
   
   use Apache::Test;
  -use Apache::TestUtil;
  -
  -use APR::String ();
   
   use Apache::Const -compile => 'OK';
   
  -my %size_string = (
  -    '-1'            => "  - ",
  -    0               => "  0 ",
  -    42              => " 42 ",
  -    42_000          => " 41K",
  -    42_000_000      => " 40M",
  -#    42_000_000_000   => "40G",
  -);
  +require TestAPRlib::string;
   
   sub handler {
       my $r = shift;
   
  -    plan $r, tests => scalar keys %size_string;
  +    my $num_of_tests = TestAPRlib::string::num_of_tests();
  +    plan $r, tests => $num_of_tests;
   
  -    t_debug("size_string");
  -    while (my($k, $v) = each %size_string) {
  -        ok t_cmp($v, APR::String::format_size($k));
  -    }
  +    TestAPRlib::string::test();
   
       Apache::OK;
   }