Skip to content

Commit

Permalink
pp_addpm more helpful error
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Feb 28, 2024
1 parent 6ecabb8 commit bd50636
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Basic/Gen/PP.pm
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ sub _pp_addpm_nolineno {
if (ref $pm) {
my $opt = $pm;
$pm = shift;
croak "unknown option" unless defined $opt->{At} &&
confess "unknown option '$opt->{At}' (only Top|Bot|Middle)" unless defined $opt->{At} &&
$opt->{At} =~ /^(Top|Bot|Middle)$/;
$pos = $opt->{At};
} else {
Expand Down
3 changes: 3 additions & 0 deletions t/pp_croaking.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ use PDL::PP qw(foo::bar foo::bar foobar);
# Prevent file generation (does not prevent calling of functions)
$PDL::PP::done = 1;

eval {pp_addpm({At=>'Mid'}, "blah")};
like $@, qr/Middle/, 'pp_addpm says valid options';

# Check the loop malformed call:
eval {
pp_def(test1 =>
Expand Down

0 comments on commit bd50636

Please sign in to comment.