summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzach%zachlipton.com <>2002-01-11 12:53:18 +0100
committerzach%zachlipton.com <>2002-01-11 12:53:18 +0100
commit24a0df9447592714dc431fcf25c90ca29215629f (patch)
treeabb27dd1309cdeaadc7c0affc79fc5ea773c47b8
parentba97186027ce99bcbd0f19d52bf2e8f7a53ade39 (diff)
downloadbugzilla-24a0df9447592714dc431fcf25c90ca29215629f.tar.gz
bugzilla-24a0df9447592714dc431fcf25c90ca29215629f.tar.xz
Additional fix for bug 112914: "Test should not `cat $file`" Previous
patch fixed the problem, but this patch stops once it finds strict so it will not take as long to run. Patch by ddkilzer@theracingworld.com. R=zach@zachlipton.com though review is not required for tests.
-rw-r--r--t/002goodperl.t62
1 files changed, 35 insertions, 27 deletions
diff --git a/t/002goodperl.t b/t/002goodperl.t
index e9ade3900..9c99a799a 100644
--- a/t/002goodperl.t
+++ b/t/002goodperl.t
@@ -19,6 +19,7 @@
#
# Contributor(s): Zach Lipton <zach@zachlipton.com>
# Jacob Steenhagen <jake@acutex.net>
+# David D. Kilzer <ddkilzer@theracingworld.com>
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU General Public License Version 2 or later (the
@@ -47,37 +48,44 @@ use strict;
my @testitems = @Support::Files::testitems; # get the files to test.
foreach my $file (@testitems) {
- $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
- next if (!$file); # skip null entries
- open (FILE, $file);
- my @file = <FILE>;
- close (FILE);
- if ($file[0] !~ /\/usr\/bonsaitools\/bin\/perl/) {
- ok(1,"$file does not have a shebang");
- next;
+ $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
+ next if (!$file); # skip null entries
+ if (! open (FILE, $file)) {
+ ok(0,"could not open $file --WARNING");
+ }
+ my $file_line1 = <FILE>;
+ close (FILE);
+ if ($file_line1 !~ /\/usr\/bonsaitools\/bin\/perl/) {
+ ok(1,"$file does not have a shebang");
+ } else {
+ if ($file_line1 =~ m#/usr/bonsaitools/bin/perl -w#) {
+ ok(1,"$file uses -w");
} else {
- if ($file[0] =~ m#/usr/bonsaitools/bin/perl -w#) {
- ok(1,"$file uses -w");
- next;
- } else {
- ok(0,"$file is MISSING -w --WARNING");
- next;
- }
+ ok(0,"$file is MISSING -w --WARNING");
}
+ }
}
+
foreach my $file (@testitems) {
- $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
- next if (!$file); # skip null entries
- open (FILE, $file);
- my @file = <FILE>;
- close (FILE);
- if (grep /^\s*use strict/, @file) {
- ok(1,"$file uses strict");
- } else {
- ok(0,"$file DOES NOT use strict --WARNING");
+ my $found_use_strict = 0;
+ $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
+ next if (!$file); # skip null entries
+ if (! open (FILE, $file)) {
+ ok(0,"could not open $file --WARNING");
+ next;
+ }
+ while (my $file_line = <FILE>) {
+ if ($file_line =~ m/^\s*use strict/) {
+ $found_use_strict = 1;
+ last;
}
+ }
+ close (FILE);
+ if ($found_use_strict) {
+ ok(1,"$file uses strict");
+ } else {
+ ok(0,"$file DOES NOT use strict --WARNING");
+ }
}
-
-
-
+exit 0;