Commit 5ac0fa09 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 817634: Tests in t/ should also check themselves where appropriate

r=glob a=LpSolit
parent 0d02249a
...@@ -15,7 +15,8 @@ use 5.10.1; ...@@ -15,7 +15,8 @@ use 5.10.1;
use lib qw(. lib t); use lib qw(. lib t);
use Config; use Config;
use Support::Files; use Support::Files;
use Test::More tests => scalar(@Support::Files::testitems); use Test::More tests => scalar(@Support::Files::testitems)
+ scalar(@Support::Files::test_files);
BEGIN { BEGIN {
use_ok('Bugzilla::Constants'); use_ok('Bugzilla::Constants');
...@@ -59,7 +60,7 @@ sub compile_file { ...@@ -59,7 +60,7 @@ sub compile_file {
ok(!$return_val, $file) or diag('--ERROR'); ok(!$return_val, $file) or diag('--ERROR');
} }
my @testitems = @Support::Files::testitems; my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
my $file_features = map_files_to_features(); my $file_features = map_files_to_features();
# Test the scripts by compiling them # Test the scripts by compiling them
......
...@@ -17,10 +17,11 @@ use Support::Files; ...@@ -17,10 +17,11 @@ use Support::Files;
use Support::Templates; use Support::Templates;
use File::Spec; use File::Spec;
use Test::More tests => ( scalar(@Support::Files::testitems) use Test::More tests => (scalar(@Support::Files::testitems)
+ scalar(@Support::Files::test_files)
+ $Support::Templates::num_actual_files) * 3; + $Support::Templates::num_actual_files) * 3;
my @testitems = @Support::Files::testitems; my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
for my $path (@Support::Templates::include_paths) { for my $path (@Support::Templates::include_paths) {
push(@testitems, map(File::Spec->catfile($path, $_), push(@testitems, map(File::Spec->catfile($path, $_),
Support::Templates::find_actual_files($path))); Support::Templates::find_actual_files($path)));
......
...@@ -13,29 +13,29 @@ ...@@ -13,29 +13,29 @@
use lib 't'; use lib 't';
use Support::Files; use Support::Files;
BEGIN { # yes the indenting is off, deal with it BEGIN {
#add the words to check here: #add the words to check here:
@evilwords = qw( @evilwords = qw(
anyways anyways
appearence appearence
arbitary arbitary
cancelled cancelled
critera critera
databasa databasa
dependan dependan
existance existance
existant existant
paramater paramater
refered refered
repsentation repsentation
suported suported
varsion varsion
); );
$testcount = scalar(@Support::Files::testitems);
} }
use Test::More tests => $testcount; # -1 because 006spellcheck.t must not be checked.
use Test::More tests => scalar(@Support::Files::testitems)
+ scalar(@Support::Files::test_files) - 1;
# Capture the TESTOUT from Test::More or Test::Builder for printing errors. # Capture the TESTOUT from Test::More or Test::Builder for printing errors.
# This will handle verbosity for us automatically. # This will handle verbosity for us automatically.
...@@ -51,7 +51,7 @@ my $fh; ...@@ -51,7 +51,7 @@ my $fh;
} }
} }
my @testitems = @Support::Files::testitems; my @testitems = (@Support::Files::testitems, @Support::Files::test_files);
# at last, here we actually run the test... # at last, here we actually run the test...
my $evilwordsregexp = join('|', @evilwords); my $evilwordsregexp = join('|', @evilwords);
...@@ -59,6 +59,9 @@ my $evilwordsregexp = join('|', @evilwords); ...@@ -59,6 +59,9 @@ my $evilwordsregexp = join('|', @evilwords);
foreach my $file (@testitems) { foreach my $file (@testitems) {
$file =~ s/\s.*$//; # nuke everything after the first space (#comment) $file =~ s/\s.*$//; # nuke everything after the first space (#comment)
next if (!$file); # skip null entries next if (!$file); # skip null entries
# Do not try to validate this file as it obviously contains a list
# of wrongly spelled words.
next if ($file eq 't/006spellcheck.t');
if (open (FILE, $file)) { # open the file for reading if (open (FILE, $file)) { # open the file for reading
......
...@@ -24,6 +24,8 @@ foreach my $extension (@extensions) { ...@@ -24,6 +24,8 @@ foreach my $extension (@extensions) {
find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension); find(sub { push(@files, $File::Find::name) if $_ =~ /\.pm$/;}, $extension);
} }
@test_files = glob('t/*.t');
sub isTestingFile { sub isTestingFile {
my ($file) = @_; my ($file) = @_;
my $exclude; my $exclude;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment