4 if ( $ENV{PERL_CORE} ) {
6 @INC = ( '../lib', 'lib' );
22 # to add a new test to proverun, just list the name of the file in
23 # t/sample-tests and a name for the test. The rest is handled
27 name => 'Create empty',
29 { file => 'todo_inline',
30 name => 'Passing TODO',
33 foreach my $test (@tests) {
35 # let's fully expand that filename
36 $test->{file} = File::Spec->catfile(
38 ? ( File::Spec->updir(), 'ext', 'Test', 'Harness' )
49 args => [ $_->{file} ],
52 'TAP::Parser::Iterator::Process',
68 plan tests => @SCHEDULE * 3;
71 # Waaaaay too much boilerplate
76 @ISA = qw( App::Prove );
80 my $self = $class->SUPER::new(@_);
87 my @log = @{ $self->{_log} };
95 use TAP::Parser::Iterator::Process;
96 use TAP::Formatter::Console;
98 # Patch TAP::Parser::Iterator::Process
101 local $^W; # no warnings
103 my $orig_new = TAP::Parser::Iterator::Process->can('new');
105 # Avoid "used only once" warning
106 *TAP::Parser::Iterator::Process::new
107 = *TAP::Parser::Iterator::Process::new = sub {
108 push @call_log, [ 'new', @_ ];
110 # And then new turns round and tramples on our args...
111 $_[1] = { %{ $_[1] } };
115 # Patch TAP::Formatter::Console;
116 my $orig_output = \&TAP::Formatter::Console::_output;
117 *TAP::Formatter::Console::_output = sub {
119 # push @call_log, [ '_output', @_ ];
131 if ( my $ref = ref $obj ) {
132 if ( 'HASH' eq ref $obj ) {
133 return { map { $_ => _slacken( $obj->{$_} ) } keys %$obj };
135 elsif ( 'ARRAY' eq ref $obj ) {
136 return [ map { _slacken($_) } @$obj ];
138 elsif ( 'SCALAR' eq ref $obj ) {
150 sub is_slackly($$$) {
151 my ( $got, $want, $msg ) = @_;
152 return is_deeply _slacken($got), _slacken($want), $msg;
156 for my $test (@SCHEDULE) {
157 my $name = $test->{name};
159 my $app = FakeProve->new;
160 $app->process_args( '--norc', @{ $test->{args} } );
162 # Why does this make the output from the test spew out of
164 ok eval { $app->run }, 'run returned true';
165 ok !$@, 'no errors' or diag $@;
169 # Bodge: we don't know what pathname will be used for the exe so we
170 # obliterate it here. Need to test that it's sane.
171 for my $call (@log) {
172 if ( 'HASH' eq ref $call->[2] && exists $call->[2]->{command} ) {
173 $call->[2]->{command}->[0] = 'PERL';
177 is_slackly \@log, $test->{expect}, "$name: command args OK";
182 # expect => $test->{expect}