Skip to content

Commit

Permalink
removing conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
kentfredric committed Jul 5, 2009
1 parent a0f78a3 commit 2bdd11d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 41 deletions.
28 changes: 14 additions & 14 deletions xt/boilerplate.t
Expand Up @@ -5,42 +5,42 @@ use warnings;
use Test::More tests => 1;

sub not_in_file_ok {
my ($filename, %regex) = @_;
my ( $filename, %regex ) = @_;
open( my $fh, '<', $filename )
or die "couldn't open $filename for reading: $!";
or die "couldn't open $filename for reading: $!";

my %violated;

while (my $line = <$fh>) {
while (my ($desc, $regex) = each %regex) {
if ($line =~ $regex) {
push @{$violated{$desc}||=[]}, $.;
while ( my $line = <$fh> ) {
while ( my ( $desc, $regex ) = each %regex ) {
if ( $line =~ $regex ) {
push @{ $violated{$desc} ||= [] }, $.;
}
}
}

if (%violated) {
fail("$filename contains boilerplate text");
diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
} else {
}
else {
pass("$filename contains no boilerplate text");
}
}

sub module_boilerplate_ok {
my ($module) = @_;
not_in_file_ok($module =>
'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
not_in_file_ok(
$module => 'the great new $MODULENAME' => qr/ - The great new /,
'boilerplate description' => qr/Quick summary of what the module/,
'stub function definition' => qr/function[12]/,
);
}

TODO: {
local $TODO = "Need to replace the boilerplate text";

module_boilerplate_ok('lib/ELF/Extract/Sections.pm');
local $TODO = "Need to replace the boilerplate text";

module_boilerplate_ok('lib/ELF/Extract/Sections.pm');

}

11 changes: 0 additions & 11 deletions xt/kwaliee.t

This file was deleted.

9 changes: 9 additions & 0 deletions xt/kwalitee.t
@@ -0,0 +1,9 @@

use strict;
use warnings;

use Test::More;
use Test::Kwalitee;



15 changes: 2 additions & 13 deletions xt/pod-coverage.t
@@ -1,18 +1,7 @@
use strict;
use warnings;
use Test::More;

# Ensure a recent version of Test::Pod::Coverage
my $min_tpc = 1.08;
eval "use Test::Pod::Coverage $min_tpc";
plan skip_all => "Test::Pod::Coverage $min_tpc required for testing POD coverage"
if $@;

# Test::Pod::Coverage doesn't require a minimum Pod::Coverage version,
# but older versions don't recognize some common documentation styles
my $min_pc = 0.18;
eval "use Pod::Coverage $min_pc";
plan skip_all => "Pod::Coverage $min_pc required for testing POD coverage"
if $@;
use Test::Pod::Coverage 1.08;
use Pod::Coverage 0.18;

all_pod_coverage_ok();
4 changes: 1 addition & 3 deletions xt/pod.t
Expand Up @@ -5,8 +5,6 @@ use warnings;
use Test::More;

# Ensure a recent version of Test::Pod
my $min_tp = 1.22;
eval "use Test::Pod $min_tp";
plan skip_all => "Test::Pod $min_tp required for testing POD" if $@;
use Test::Pod 1.22;

all_pod_files_ok();

0 comments on commit 2bdd11d

Please sign in to comment.