diff --git a/t/03_keep_comparing_keeps_comparing.t b/t/03_keep_comparing_keeps_comparing.t index 53af90f..129f1ed 100644 --- a/t/03_keep_comparing_keeps_comparing.t +++ b/t/03_keep_comparing_keeps_comparing.t @@ -2,44 +2,32 @@ use strict; use warnings; use Test::More 0.96; -use Test::MockObject; use FindBin; - -my $mock = Test::MockObject->new(); - -my @events; - -$mock->mock( - 'ok' => sub { - my ( $self, @args ) = @_; - push @events, [ 'ok', @args ]; - } -); - -$mock->mock( - 'diag' => sub { - my ( $self, @args ) = @_; - push @events, [ 'diag', @args ]; +use lib "$FindBin::Bin/lib"; +use mocktest; + +my $mock = mocktest->new(); + +use Test::CPAN::Changes::ReallyStrict (); +my $res = Test::CPAN::Changes::ReallyStrict::_real_changes_file_ok( + $mock, + { + delete_empty_groups => undef, + keep_comparing => 1, + filename => "$FindBin::Bin/../corpus/Changes_02.txt", } ); -use Test::CPAN::Changes::ReallyStrict; - -ok( - !Test::CPAN::Changes::ReallyStrict::_real_changes_file_ok( - $mock, - { - delete_empty_groups => undef, - keep_comparing => 1, - filename => "$FindBin::Bin/../corpus/Changes_02.txt", - } - ), - "Expected bad file is bad ( In progress" - ) - or do { - note explain \@events; - }; - -is( scalar @events, 579, "There is 579 events sent to the test system with this option on" ) or note explain \@events; +my $need_diag; + +if ( not ok( !$res, "Expected bad file is bad ( In progress )" ) ) { + $need_diag = 1; +} +if ( not is( $mock->num_events, 708, "There is 708 events sent to the test system with this option on" ) ) { + $need_diag = 1; +} +if ($need_diag) { + diag $_ for $mock->ls_events; +} done_testing;