aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorjouni%heikniemi.net <>2004-09-02 03:11:59 +0000
committerjouni%heikniemi.net <>2004-09-02 03:11:59 +0000
commit3a37c59531cd5720cdf40a25e7f8e2a18c6eb912 (patch)
tree61ff1add0bcd5f5632278034ba4c2219fcc689ac /t
parentPatch for bug 254371: include Flag Types in create new attachments form; patc... (diff)
downloadbugzilla-3a37c59531cd5720cdf40a25e7f8e2a18c6eb912.tar.gz
bugzilla-3a37c59531cd5720cdf40a25e7f8e2a18c6eb912.tar.bz2
bugzilla-3a37c59531cd5720cdf40a25e7f8e2a18c6eb912.zip
Bug 257111: t/006spellcheck.t should check each file only once.
Patch by Marc Schumann <marcschum@web.de> r=jouni, a=myk
Diffstat (limited to 't')
-rw-r--r--t/006spellcheck.t37
1 files changed, 17 insertions, 20 deletions
diff --git a/t/006spellcheck.t b/t/006spellcheck.t
index 29196cf1f..232ffb237 100644
--- a/t/006spellcheck.t
+++ b/t/006spellcheck.t
@@ -37,7 +37,7 @@ existance
existant
);
-$testcount = scalar(@Support::Files::testitems) * scalar(@evilwords);
+$testcount = scalar(@Support::Files::testitems);
}
use Test::More tests => $testcount;
@@ -59,35 +59,32 @@ my $fh;
my @testitems = @Support::Files::testitems;
# at last, here we actually run the test...
+my $evilwordsregexp = join('|', @evilwords);
foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment)
next if (!$file); # skip null entries
- foreach my $word (@evilwords) { # go through the evilwords
-
- if (open (FILE, $file)) { # open the file for reading
- my $found_word = 0;
+ if (open (FILE, $file)) { # open the file for reading
- while (my $file_line = <FILE>) { # and go through the file line by line
- if ($file_line =~ /$word/i) { # found an evil word
- $found_word = 1;
- last;
- }
+ my $found_word = '';
+
+ while (my $file_line = <FILE>) { # and go through the file line by line
+ if ($file_line =~ /($evilwordsregexp)/i) { # found an evil word
+ $found_word = $1;
+ last;
}
+ }
- if ($found_word) {
- ok(0,"$file: found SPELLING ERROR $word --WARNING");
- }
- else {
- ok(1,"$file does not contain the spelling error $word");
- }
+ close (FILE);
- close (FILE);
- }
- else {
- ok(0,"could not open $file for spellcheck --WARNING");
+ if ($found_word) {
+ ok(0,"$file: found SPELLING ERROR $found_word --WARNING");
+ } else {
+ ok(1,"$file does not contain registered spelling errors");
}
+ } else {
+ ok(0,"could not open $file for spellcheck --WARNING");
}
}