Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tidied tests

  • Loading branch information...
commit 9479ce10b95a9fee4c7237968c1c1ad725c14a53 1 parent c2d888a
@mfontani authored
Showing with 34 additions and 37 deletions.
  1. +2 −2 t/00-load.t
  2. +28 −31 t/boilerplate.t
  3. +4 −4 t/pod-coverage.t
View
4 t/00-load.t
@@ -3,7 +3,7 @@
use Test::More tests => 1;
BEGIN {
- use_ok( 'Net::RackSpace::CloudServers' );
+ use_ok('Net::RackSpace::CloudServers');
}
-diag( "Testing Net::RackSpace::CloudServers $Net::RackSpace::CloudServers::VERSION, Perl $], $^X" );
+diag("Testing Net::RackSpace::CloudServers $Net::RackSpace::CloudServers::VERSION, Perl $], $^X");
View
59 t/boilerplate.t
@@ -5,51 +5,48 @@ use warnings;
use Test::More tests => 3;
sub not_in_file_ok {
- my ($filename, %regex) = @_;
- open( my $fh, '<', $filename )
- 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}||=[]}, $.;
- }
- }
- }
+ my ( $filename, %regex ) = @_;
+ open( my $fh, '<', $filename )
+ or die "couldn't open $filename for reading: $!";
+
+ my %violated;
- if (%violated) {
- fail("$filename contains boilerplate text");
- diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
- } else {
- pass("$filename contains no boilerplate text");
+ 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 {
+ 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]/,
- );
+ 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]/,
+ );
}
TODO: {
local $TODO = "Need to replace the boilerplate text";
- not_in_file_ok(README =>
- "The README is used..." => qr/The README is used/,
- "'version information here'" => qr/to provide version information/,
+ not_in_file_ok(
+ README => "The README is used..." => qr/The README is used/,
+ "'version information here'" => qr/to provide version information/,
);
- not_in_file_ok(Changes =>
- "placeholder date/time" => qr(Date/time)
- );
+ not_in_file_ok( Changes => "placeholder date/time" => qr(Date/time) );
module_boilerplate_ok('lib/Net/RackSpace/CloudServers.pm');
-
}
View
8 t/pod-coverage.t
@@ -6,17 +6,17 @@ use Test::More;
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 $@;
+ 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 $@;
+ if $@;
eval "use Pod::Coverage::Moose";
plan skip_all => "Pod::Coverage::Moose required for testing POD coverage"
- if $@;
+ if $@;
-all_pod_coverage_ok({coverage_class => 'Pod::Coverage::Moose'});
+all_pod_coverage_ok( { coverage_class => 'Pod::Coverage::Moose' } );
Please sign in to comment.
Something went wrong with that request. Please try again.