aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-16 15:05:23 -0700
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-06-16 15:05:23 -0700
commit17867ff914674c065649b022e7451a015d720c78 (patch)
treec408d9e05a46c1571c057fff5a5d3d1297dfab38
parent67cf215f79566b3559ec1491d786e8bc02907b74 (diff)
downloadbugs-17867ff914674c065649b022e7451a015d720c78.tar
bugs-17867ff914674c065649b022e7451a015d720c78.tar.gz
bugs-17867ff914674c065649b022e7451a015d720c78.tar.bz2
bugs-17867ff914674c065649b022e7451a015d720c78.tar.xz
bugs-17867ff914674c065649b022e7451a015d720c78.zip
Bug 559999: Make t/010dependencies.t consider "use base" to be just like "use"
r=timello, a=mkanat
-rw-r--r--t/010dependencies.t38
1 files changed, 24 insertions, 14 deletions
diff --git a/t/010dependencies.t b/t/010dependencies.t
index 977c8aa67..3289d098e 100644
--- a/t/010dependencies.t
+++ b/t/010dependencies.t
@@ -21,8 +21,7 @@
## dependencies ##
use strict;
-
-use lib 't';
+use lib qw(. lib t);
use Support::Files;
use Test::More qw(no_plan);
@@ -30,6 +29,16 @@ use Test::More qw(no_plan);
my %mods;
my %deps;
+use constant MODULE_REGEX => qr/
+ (?:(?:^\s*use)
+ |
+ (?:^require)
+ )\s+
+ ['"]?
+ ([\w:\.\\]+)
+/x;
+use constant BASE_REGEX => qr/^use base qw\(([^\)]+)/;
+
# Extract all Perl modules.
foreach my $file (@Support::Files::testitems) {
if ($file =~ /^(.*)\.pm$/) {
@@ -58,18 +67,19 @@ foreach my $module (keys %mods) {
if ($line =~ /^package\s+([^;]);/) {
$module = $1;
}
- elsif ($line =~ /^\s*(?:use|^require) *"?(Bugzilla.*?)"?(?:;|\s+qw[\(\{]|\s+\(\))/) {
- my $used = $1;
- $used =~ s#/#::#g;
- $used =~ s#\.pm$##;
- $used =~ s#\$module#[^:]+#;
- $used =~ s#\${[^}]+}#[^:]+#;
- $used =~ s#[" ]##g;
- my $exclude = "";
- if ($used eq 'Bugzilla::Auth::Login::[^:]+' ) { $exclude = 'Bugzilla::Auth::Login::Stack' }
- elsif ($used eq 'Bugzilla::Auth::Verify::[^:]+') { $exclude = 'Bugzilla::Auth::Verify::Stack' }
- elsif ($used eq 'Bugzilla::Config::[^:]+' ) { $exclude = 'Bugzilla::Config::Common' }
- push(@use, grep(/^$used$/, grep(!/^$exclude$/, keys %mods)));
+ elsif ($line =~ BASE_REGEX or $line =~ MODULE_REGEX) {
+ my $used_string = $1;
+ # "use base" can have multiple modules
+ my @used_array = split(/\s+/, $used_string);
+ foreach my $used (@used_array) {
+ next if $used !~ /^Bugzilla/;
+ $used =~ s#/#::#g;
+ $used =~ s#\.pm$##;
+ $used =~ s#\$module#[^:]+#;
+ $used =~ s#\${[^}]+}#[^:]+#;
+ $used =~ s#[" ]##g;
+ push(@use, grep(/^\Q$used\E$/, keys %mods));
+ }
}
}
close (SOURCE);