Skip to content

Commit

Permalink
Merge pull request #24 from tvroom/match_undef_test
Browse files Browse the repository at this point in the history
Match undef test
  • Loading branch information
davorg committed Oct 13, 2016
2 parents 4962b3f + 3f65012 commit c94ac03
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions t/match_undef.t
@@ -0,0 +1,33 @@
use Test::More qw();
#Don't import anything or test routines become potential matches during the test

use Symbol::Approx::Sub (
xform => undef,
match => undef
);

sub aa { 'aa' }

sub bb { 'bb' }

sub cc { 'cc' }

my $total_tries = 1000;
my $tries_left = $total_tries;

my %remaining_returns = (
'aa' => 1,
'bb' => 1,
'cc' => 1,
);

while($tries_left >= 0) {
my $ret_val = b();
delete $remaining_returns{$ret_val};
last if !keys %remaining_returns;
$tries_left--;
}

Test::More::ok !keys %remaining_returns, "Got all expected return values (covering all our subroutines) in <= $total_tries tries";

Test::More::done_testing();

0 comments on commit c94ac03

Please sign in to comment.