Skip to content

Commit

Permalink
Merge 5041f8f into 2c98813
Browse files Browse the repository at this point in the history
  • Loading branch information
bayashi committed Apr 24, 2020
2 parents 2c98813 + 5041f8f commit 4b80c02
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions cpanfile
Expand Up @@ -3,6 +3,7 @@
requires 'perl', '5.008005';
requires 'strict';
requires 'warnings';
requires 'Carp';
requires 'Test::Builder::Module';
requires 'Test::Name::FromLine';
requires 'Text::MatchedPosition';
Expand Down
17 changes: 9 additions & 8 deletions lib/Test/Arrow.pm
@@ -1,6 +1,7 @@
package Test::Arrow;
use strict;
use warnings;
use Carp qw/croak/;
use Test::Builder::Module;
use Test::Name::FromLine;
use Text::MatchedPosition;
Expand Down Expand Up @@ -28,7 +29,7 @@ sub import {
$pkg->_import_option_binary(\%args);

if (scalar(keys %args) > 0) {
die "Wrong option: " . join(", ", keys %args);
croak "Wrong option: " . join(", ", keys %args);
}

if ($] < 5.014000) {
Expand Down Expand Up @@ -158,7 +159,7 @@ sub expected {
my $arg_count = scalar(@_) - 1;

if ($arg_count > 1) {
die "'expected' method expects just only one arg. You passed $arg_count args.";
croak "'expected' method expects just only one arg. You passed $arg_count args.";
}

$self->{_expected} = $value;
Expand All @@ -172,7 +173,7 @@ sub got {
my $arg_count = scalar(@_) - 1;

if ($arg_count > 1) {
die "'got' method expects just only one arg. You passed $arg_count args.";
croak "'got' method expects just only one arg. You passed $arg_count args.";
}

$self->{_got} = $value;
Expand Down Expand Up @@ -382,7 +383,7 @@ sub isa_ok {
my ($result, $error) = _tb->_try(sub { $got->isa($expected) });

if ($error) {
die <<WHOA unless $error =~ /^Can't (locate|call) method "isa"/;
croak <<WHOA unless $error =~ /^Can't (locate|call) method "isa"/;
WHOA! I tried to call ->isa on your $whatami and got some weird error.
Here's the error.
$error
Expand Down Expand Up @@ -442,7 +443,7 @@ sub _get_isa_diag_name {
$diag = "$test_name isn't a '$expected'";
}
else {
die;
croak;
}

return($diag, $name);
Expand All @@ -464,7 +465,7 @@ sub throw {
my $self = shift;
my $code = shift;

die 'The `throw` method expects code ref.' unless ref $code eq 'CODE';
croak 'The `throw` method expects code ref.' unless ref $code eq 'CODE';

eval { $code->() };

Expand Down Expand Up @@ -523,7 +524,7 @@ sub warnings_ok {
sub warnings {
my ($self, $code, $regex, $name) = @_;

die 'The `warn` method expects code ref.' unless ref $code eq 'CODE';
croak 'The `warn` method expects code ref.' unless ref $code eq 'CODE';

my @warns;
eval {
Expand Down Expand Up @@ -678,7 +679,7 @@ sub __deep_check_type {
$ok = FAIL;
}
else {
die <<_WHOA_;
croak <<_WHOA_;
WHOA! No type in _deep_check
This should never happen! Please contact the author immediately!
_WHOA_
Expand Down

0 comments on commit 4b80c02

Please sign in to comment.