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 * 2;
50 # Waaaaay too much boilerplate
55 @ISA = qw( App::Prove );
59 my $self = $class->SUPER::new(@_);
66 push @{ $self->{_log} }, [ '_exit', @_ ];
72 my @log = @{ $self->{_log} };
80 use TAP::Parser::Iterator::Process;
81 use TAP::Formatter::Console;
83 # Patch TAP::Parser::Iterator::Process
86 local $^W; # no warnings
88 my $orig_new = \&TAP::Parser::Iterator::Process::new;
89 *TAP::Parser::Iterator::Process::new = sub {
90 push @call_log, [ 'new', @_ ];
92 # And then new turns round and tramples on our args...
93 $_[1] = { %{ $_[1] } };
97 # Patch TAP::Formatter::Console;
98 my $orig_output = \&TAP::Formatter::Console::_output;
99 *TAP::Formatter::Console::_output = sub {
101 # push @call_log, [ '_output', @_ ];
113 if ( my $ref = ref $obj ) {
114 if ( 'HASH' eq ref $obj ) {
115 return { map { $_ => _slacken( $obj->{$_} ) } keys %$obj };
117 elsif ( 'ARRAY' eq ref $obj ) {
118 return [ map { _slacken($_) } @$obj ];
120 elsif ( 'SCALAR' eq ref $obj ) {
132 sub is_slackly($$$) {
133 my ( $got, $want, $msg ) = @_;
134 return is_deeply _slacken($got), _slacken($want), $msg;
138 for my $test (@SCHEDULE) {
139 my $name = $test->{name};
141 my $app = FakeProve->new;
142 $app->process_args( '--norc', @{ $test->{args} } );
144 # Why does this make the output from the test spew out of
147 like $@, qr{Exited}, "$name: exited via _exit()";
151 # Bodge: we don't know what pathname will be used for the exe so we
152 # obliterate it here. Need to test that it's sane.
153 for my $call (@log) {
154 if ( 'HASH' eq ref $call->[2] && exists $call->[2]->{command} ) {
155 $call->[2]->{command}->[0] = 'PERL';
159 is_slackly \@log, $test->{expect}, "$name: command args OK";
164 # expect => $test->{expect}