perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestAPI module.pm
Date Tue, 17 Aug 2004 20:39:46 GMT
gozer       2004/08/17 13:39:46

  Modified:    t/response/TestAPI module.pm
  Log:
  Improve Apache::Module tests to make usage of the entire API on the
  whole apache module list.
  
  Revision  Changes    Path
  1.16      +24 -38    modperl-2.0/t/response/TestAPI/module.pm
  
  Index: module.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestAPI/module.pm,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- module.pm	11 Aug 2004 00:13:50 -0000	1.15
  +++ module.pm	17 Aug 2004 20:39:46 -0000	1.16
  @@ -18,50 +18,20 @@
       my $r = shift;
   
       my $cfg = Apache::Test::config();
  -
  +    
       my $top_module = Apache::Module->top_module;
   
  -    #no promise that mod_perl will be the top_module
  -    my $top_module_name = (defined $top_module && $top_module->name()) || '';
  +    my $module_count = 0;
  +    for (my $modp = $top_module; $modp; $modp = $modp->next) {
  +        $module_count++;
  +    }
   
  -    my $tests = 11;
  +    my $tests = 10 + ( 5 * $module_count );
   
       plan $r, tests => $tests;
   
  -    t_debug "top_module: $top_module_name";
  -    ok $top_module;
  -
  -    ok t_cmp($top_module->version,
  -             $cfg->{httpd_info}->{MODULE_MAGIC_NUMBER_MAJOR},
  -             q{$top_module->version});
  -
  -    ok t_cmp($top_module->module_index,
  -             scalar(keys %{ $cfg->{modules} }),
  -             q{$top_module->module_index})
  -        || 1; # the A-T config could be wrong
  -
  -    if (0) { #XXX: currently fails with --enable-mods-shared=all
  -        local $cfg->{modules}->{'mod_perl.c'} = 1;
  -        my $modules = {};
  -
  -        for (my $modp = $top_module; $modp; $modp = $modp->next) {
  -            if ($modp && $modp->name) {
  -                $modules->{$modp->name} = 1;
  -            }
  -        }
  -
  -        my %alias = (
  -            'sapi_apache2.c' => 'mod_php4.c',
  -        );
  -
  -        while (my($key, $val) = each %alias) {
  -            next unless $modules->{$key};
  -            delete $modules->{$key};
  -            $modules->{$val} = 1;
  -        }
  -
  -        ok t_cmp($modules, $cfg->{modules}, "Modules list");
  -    }
  +    my $core = Apache::Module::find_linked_module('core.c');
  +    ok defined $core && $core->name eq 'core.c';
   
       #.c
       ok t_cmp(Apache::Module::loaded('mod_perl.c'), 1,
  @@ -94,6 +64,22 @@
   
       ok t_cmp(Apache::Module::loaded(''), 0,
                "Apache::Module::loaded('')");
  +
  +    
  +    ok t_cmp ref($top_module), 'Apache::Module', 'top_module';
  +
  +    my $mmn_major = $cfg->{httpd_info}{MODULE_MAGIC_NUMBER_MAJOR};
  +    my $mmn_minor = $cfg->{httpd_info}{MODULE_MAGIC_NUMBER_MINOR};
  +    for (my $modp = $top_module; $modp; $modp = $modp->next) {
  +        my $name = $modp->name;
  +        ok $name;
  +        t_debug("Testing module: " . $modp->name);
  +        ok $modp->version == $mmn_major;
  +        ok $modp->minor_version <= $mmn_minor;
  +        ok $modp->module_index >= 0;
  +        my $cmds = $modp->cmds;
  +        ok !defined($cmds) || ref($cmds) eq 'Apache::Command';
  +    }
   
       Apache::OK;
   }
  
  
  

Mime
View raw message