16 # to add a new test to proverun, just list the name of the file in
17 # t/sample-tests and a name for the test. The rest is handled
21 name => 'Create empty',
23 { file => 'todo_inline',
24 name => 'Passing TODO',
27 foreach my $test (@tests) {
29 # let's fully expand that filename
30 $test->{file} = File::Spec->catfile(
39 args => [ $_->{file} ],
42 'TAP::Parser::Iterator::Process',
58 plan tests => @SCHEDULE * 3;
61 # Waaaaay too much boilerplate
66 @ISA = qw( App::Prove );
70 my $self = $class->SUPER::new(@_);
77 my @log = @{ $self->{_log} };
85 use TAP::Parser::Iterator::Process;
86 use TAP::Formatter::Console;
88 # Patch TAP::Parser::Iterator::Process
91 local $^W; # no warnings
93 my $orig_new = TAP::Parser::Iterator::Process->can('new');
95 # Avoid "used only once" warning
96 *TAP::Parser::Iterator::Process::new
97 = *TAP::Parser::Iterator::Process::new = sub {
98 push @call_log, [ 'new', @_ ];
100 # And then new turns round and tramples on our args...
101 $_[1] = { %{ $_[1] } };
105 # Patch TAP::Formatter::Console;
106 my $orig_output = \&TAP::Formatter::Console::_output;
107 *TAP::Formatter::Console::_output = sub {
109 # push @call_log, [ '_output', @_ ];
121 if ( my $ref = ref $obj ) {
122 if ( 'HASH' eq ref $obj ) {
123 return { map { $_ => _slacken( $obj->{$_} ) } keys %$obj };
125 elsif ( 'ARRAY' eq ref $obj ) {
126 return [ map { _slacken($_) } @$obj ];
128 elsif ( 'SCALAR' eq ref $obj ) {
140 sub is_slackly($$$) {
141 my ( $got, $want, $msg ) = @_;
142 return is_deeply _slacken($got), _slacken($want), $msg;
146 for my $test (@SCHEDULE) {
147 my $name = $test->{name};
149 my $app = FakeProve->new;
150 $app->process_args( '--norc', @{ $test->{args} } );
152 # Why does this make the output from the test spew out of
154 ok eval { $app->run }, 'run returned true';
155 ok !$@, 'no errors' or diag $@;
159 # Bodge: we don't know what pathname will be used for the exe so we
160 # obliterate it here. Need to test that it's sane.
161 for my $call (@log) {
162 if ( 'HASH' eq ref $call->[2] && exists $call->[2]->{command} ) {
163 $call->[2]->{command}->[0] = 'PERL';
167 is_slackly \@log, $test->{expect}, "$name: command args OK";
172 # expect => $test->{expect}