Skip to content

Commit

Permalink
Tidied.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyA committed Apr 18, 2011
1 parent e6c0838 commit 33203bf
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 32 deletions.
1 change: 1 addition & 0 deletions lib/App/Prove.pm
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ sub process_args {
'D|dry' => \$self->{dry},
'ext=s@' => sub {
my ( $opt, $val ) = @_;

# Workaround for Getopt::Long 2.25 handling of
# multivalue options
push @{ $self->{extensions} ||= [] }, $val;
Expand Down
18 changes: 10 additions & 8 deletions lib/App/Prove/State.pm
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,12 @@ sub new {
my %args = %{ shift || {} };

my $self = bless {
select => [],
seq => 1,
store => delete $args{store},
extensions => ( delete $args{extensions} || ['.t'] ),
result_class => ( delete $args{result_class} || 'App::Prove::State::Result' ),
select => [],
seq => 1,
store => delete $args{store},
extensions => ( delete $args{extensions} || ['.t'] ),
result_class =>
( delete $args{result_class} || 'App::Prove::State::Result' ),
}, $class;

$self->{_} = $self->result_class->new(
Expand Down Expand Up @@ -371,7 +372,8 @@ sub _get_raw_tests {
sort -d $arg
? $recurse
? $self->_expand_dir_recursive( $arg, $extensions )
: map { glob( File::Spec->catfile( $arg, "*$_" ) ) } @{$extensions}
: map { glob( File::Spec->catfile( $arg, "*$_" ) ) }
@{$extensions}
: $arg;
}
return @tests;
Expand All @@ -381,13 +383,13 @@ sub _expand_dir_recursive {
my ( $self, $dir, $extensions ) = @_;

my @tests;
my $ext_string = join( '|', map { quotemeta } @{$extensions} );
my $ext_string = join( '|', map {quotemeta} @{$extensions} );

find(
{ follow => 1, #21938
follow_skip => 2,
wanted => sub {
-f
-f
&& /(?:$ext_string)$/
&& push @tests => $File::Find::name;
}
Expand Down
6 changes: 4 additions & 2 deletions lib/TAP/Formatter/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,10 @@ sub _summary_test_header {
my $output = $self->_get_output_method($parser);
my $wait = $parser->wait;
defined $wait or $wait = '(none)';
$self->$output( sprintf "$test$spaces(Wstat: %s Tests: %d Failed: %d)\n",
$wait, $parser->tests_run, scalar $parser->failed );
$self->$output(
sprintf "$test$spaces(Wstat: %s Tests: %d Failed: %d)\n",
$wait, $parser->tests_run, scalar $parser->failed
);
$self->_printed_summary_header(1);
}

Expand Down
26 changes: 13 additions & 13 deletions t/prove.t
Original file line number Diff line number Diff line change
Expand Up @@ -1086,10 +1086,10 @@ BEGIN { # START PLAN
},

# Specify an oddball extension
{ name => 'Switch --ext=.wango',
switches => [ '--ext=.wango' ],
expect => { extensions => ['.wango'] },
runlog => [
{ name => 'Switch --ext=.wango',
switches => ['--ext=.wango'],
expect => { extensions => ['.wango'] },
runlog => [
[ '_runtests',
{ verbosity => 0,
show_count => 1,
Expand All @@ -1100,10 +1100,10 @@ BEGIN { # START PLAN
},

# Handle multiple extensions
{ name => 'Switch --ext=.foo --ext=.bar',
{ name => 'Switch --ext=.foo --ext=.bar',
switches => [ '--ext=.foo', '--ext=.bar', ],
expect => { extensions => ['.foo','.bar'] },
runlog => [
expect => { extensions => [ '.foo', '.bar' ] },
runlog => [
[ '_runtests',
{ verbosity => 0,
show_count => 1,
Expand Down Expand Up @@ -1157,10 +1157,10 @@ BEGIN { # START PLAN
sources => {
Perl => { foo => 'bar baz', avg => 0.278 },
MyCustom => {},
File => {
File => {
extensions => [ '.txt', '.tmp' ],
hash => { this => 'that', foo => 'bar'},
sep => 'foo=bar',
hash => { this => 'that', foo => 'bar' },
sep => 'foo=bar',
},
},
},
Expand All @@ -1169,10 +1169,10 @@ BEGIN { # START PLAN
{ sources => {
Perl => { foo => 'bar baz', avg => 0.278 },
MyCustom => {},
File => {
File => {
extensions => [ '.txt', '.tmp' ],
hash => { this => 'that', foo => 'bar'},
sep => 'foo=bar',
hash => { this => 'that', foo => 'bar' },
sep => 'foo=bar',
},
},
verbosity => 0,
Expand Down
7 changes: 4 additions & 3 deletions t/source.t
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,11 @@ sub ct($) {
is_dir => 0,
is_file => 1,
is_symlink => 0,
# Fix for bizarre -k bug in Strawberry Perl
sticky => ( -k $test )[-1] ? 1 : 0,
setgid => -g $test ? 1 : 0,
setuid => -u $test ? 1 : 0,
sticky => ( -k $test )[-1] ? 1 : 0,
setgid => -g $test ? 1 : 0,
setuid => -u $test ? 1 : 0,
},
'... file->* set'
);
Expand Down
12 changes: 6 additions & 6 deletions t/source_handler.t
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ my $perl = $^X;

my %file = map { $_ => File::Spec->catfile( $dir, $_ ) }
qw( source source.1 source.bat source.pl source.sh source_args.sh source.t
source.tap );
source.tap );

# Abstract base class tests
{
Expand Down Expand Up @@ -110,7 +110,7 @@ my %file = map { $_ => File::Spec->catfile( $dir, $_ ) }
},
{ name => $file{'source_args.sh'},
raw => { exec => [ $file{'source_args.sh'} ] },
test_args => [ 'foo' ],
test_args => ['foo'],
skip => $HAS_SH && $HAS_ECHO ? 0 : 1,
skip_reason => 'no /bin/sh, /bin/echo',
iclass => 'TAP::Parser::Iterator::Process',
Expand Down Expand Up @@ -357,11 +357,11 @@ sub test_handler {
skip $test->{skip_reason}, $planned if $test->{skip};

my $source = TAP::Parser::Source->new;
$source->raw( $test->{raw} ) if $test->{raw};
$source->raw( $test->{raw} ) if $test->{raw};
$source->test_args( $test->{test_args} ) if $test->{test_args};
$source->meta( $test->{meta} ) if $test->{meta};
$source->config( $test->{config} ) if $test->{config};
$source->assemble_meta if $test->{assemble_meta};
$source->meta( $test->{meta} ) if $test->{meta};
$source->config( $test->{config} ) if $test->{config};
$source->assemble_meta if $test->{assemble_meta};

my $iterator = eval { $class->make_iterator($source) };
my $e = $@;
Expand Down

0 comments on commit 33203bf

Please sign in to comment.