Skip to content

Commit

Permalink
Fix eval() usage:
Browse files Browse the repository at this point in the history
The eval() would mask the error because it wasn't reported. Instead,
we now check that both the eval succeeded and then that it's the
proper result.

The test for it (in e0b1895) makes
changes to the code for the sake of testing which I would prefer
not to merge.
  • Loading branch information
xsawyerx committed Mar 6, 2016
1 parent 3ae0241 commit 272290d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Test/Ping.pm
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ sub create_ping_object_ok {
my $name = pop @args || q{};
my $tb = $CLASS->builder;

eval { $OBJPATH = Net::Ping->new(@args); };
my $success = eval { $OBJPATH = Net::Ping->new(@args); 1; };

$tb->is_eq( ref $OBJPATH, 'Net::Ping', $name );
$tb->ok( $success && ref $OBJPATH eq 'Net::Ping', $name );
}

sub create_ping_object_not_ok {
Expand Down

0 comments on commit 272290d

Please sign in to comment.