6 print "1..0 # Skip, needs fixing. Probably an -I issue\n";
24 = File::Spec->catfile( split /\//, 't/sample-tests/simple' );
27 { name => 'Create empty',
28 args => [$sample_test],
31 'TAP::Parser::Iterator::Process',
46 plan tests => @SCHEDULE * 2;
49 # Waaaaay too much boilerplate
54 @ISA = qw( App::Prove );
58 my $self = $class->SUPER::new(@_);
65 push @{ $self->{_log} }, [ '_exit', @_ ];
71 my @log = @{ $self->{_log} };
79 use TAP::Parser::Iterator::Process;
80 use TAP::Formatter::Console;
82 # Patch TAP::Parser::Iterator::Process
85 local $^W; # no warnings
87 my $orig_new = \&TAP::Parser::Iterator::Process::new;
88 *TAP::Parser::Iterator::Process::new = sub {
89 push @call_log, [ 'new', @_ ];
91 # And then new turns round and tramples on our args...
92 $_[1] = { %{ $_[1] } };
96 # Patch TAP::Formatter::Console;
97 my $orig_output = \&TAP::Formatter::Console::_output;
98 *TAP::Formatter::Console::_output = sub {
100 # push @call_log, [ '_output', @_ ];
112 if ( my $ref = ref $obj ) {
113 if ( 'HASH' eq ref $obj ) {
114 return { map { $_ => _slacken( $obj->{$_} ) } keys %$obj };
116 elsif ( 'ARRAY' eq ref $obj ) {
117 return [ map { _slacken($_) } @$obj ];
119 elsif ( 'SCALAR' eq ref $obj ) {
131 sub is_slackly($$$) {
132 my ( $got, $want, $msg ) = @_;
133 return is_deeply _slacken($got), _slacken($want), $msg;
137 for my $test (@SCHEDULE) {
138 my $name = $test->{name};
140 my $app = FakeProve->new;
141 $app->process_args( '--norc', @{ $test->{args} } );
143 # Why does this make the output from the test spew out of
146 like $@, qr{Exited}, "$name: exited via _exit()";
150 # Bodge: we don't know what pathname will be used for the exe so we
151 # obliterate it here. Need to test that it's sane.
152 for my $call (@log) {
153 if ( 'HASH' eq ref $call->[2] && exists $call->[2]->{command} ) {
154 $call->[2]->{command}->[0] = 'PERL';
158 is_slackly \@log, $test->{expect}, "$name: command args OK";
163 # expect => $test->{expect}