4 if ( $ENV{PERL_CORE} ) {
6 @INC = ( '../lib', 'lib' );
22 my $sample_test = File::Spec->catfile(
24 ( $ENV{PERL_CORE} ? 'lib' : 't' ) . '/sample-tests/simple'
28 { name => 'Create empty',
29 args => [$sample_test],
32 'TAP::Parser::Iterator::Process',
47 plan tests => @SCHEDULE * 3;
50 # Waaaaay too much boilerplate
55 @ISA = qw( App::Prove );
59 my $self = $class->SUPER::new(@_);
66 my @log = @{ $self->{_log} };
74 use TAP::Parser::Iterator::Process;
75 use TAP::Formatter::Console;
77 # Patch TAP::Parser::Iterator::Process
80 local $^W; # no warnings
82 my $orig_new = TAP::Parser::Iterator::Process->can('new');
84 # Avoid "used only once" warning
85 *TAP::Parser::Iterator::Process::new
86 = *TAP::Parser::Iterator::Process::new = sub {
87 push @call_log, [ 'new', @_ ];
89 # And then new turns round and tramples on our args...
90 $_[1] = { %{ $_[1] } };
94 # Patch TAP::Formatter::Console;
95 my $orig_output = \&TAP::Formatter::Console::_output;
96 *TAP::Formatter::Console::_output = sub {
98 # push @call_log, [ '_output', @_ ];
110 if ( my $ref = ref $obj ) {
111 if ( 'HASH' eq ref $obj ) {
112 return { map { $_ => _slacken( $obj->{$_} ) } keys %$obj };
114 elsif ( 'ARRAY' eq ref $obj ) {
115 return [ map { _slacken($_) } @$obj ];
117 elsif ( 'SCALAR' eq ref $obj ) {
129 sub is_slackly($$$) {
130 my ( $got, $want, $msg ) = @_;
131 return is_deeply _slacken($got), _slacken($want), $msg;
135 for my $test (@SCHEDULE) {
136 my $name = $test->{name};
138 my $app = FakeProve->new;
139 $app->process_args( '--norc', @{ $test->{args} } );
141 # Why does this make the output from the test spew out of
143 ok eval { $app->run }, 'run returned true';
148 # Bodge: we don't know what pathname will be used for the exe so we
149 # obliterate it here. Need to test that it's sane.
150 for my $call (@log) {
151 if ( 'HASH' eq ref $call->[2] && exists $call->[2]->{command} ) {
152 $call->[2]->{command}->[0] = 'PERL';
156 is_slackly \@log, $test->{expect}, "$name: command args OK";
161 # expect => $test->{expect}