Skip to content

Commit

Permalink
Merge pull request #2 from manwar/tidy-up-error-message
Browse files Browse the repository at this point in the history
Tidy up error message
  • Loading branch information
freyfogle authored Oct 28, 2019
2 parents 615e8f7 + b8d7117 commit 71d542d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Data/MoneyCurrency.pm
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ reference to an array of strings that are currency codes.
=cut

sub get_currencies_for_country {
croak "get_currency received no arguments" if @_ == 0;
croak "get_currency received more than one argument" if @_ > 1;
croak "get_currencies_for_country received no arguments" if @_ == 0;
croak "get_currencies_for_country received more than one argument" if @_ > 1;
my $country = lc($_[0]);

# Return shallow copy to avoid mutating $rh_currencies_for_country
Expand Down
4 changes: 4 additions & 0 deletions t/get_currencies_for_country.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ is_deeply(get_currencies_for_country('us'), ['usd'], 'Test USA');
is_deeply(get_currencies_for_country('cu'), ['cuc', 'cup'], 'Test Cuba');
is_deeply(get_currencies_for_country('lt'), ['eur'], 'Test Lithuania');

throws_ok {
get_currencies_for_country();
} qr/no arguments/, "get_currencies_for_country() throws exception";

done_testing();

0 comments on commit 71d542d

Please sign in to comment.