Skip to content

Commit

Permalink
unknown plot type give correct error
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 25, 2024
1 parent 1e2d604 commit 0d7192c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/PDL/Graphics/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ sub _translate_plot {

my $ptn = $plot_type_abbrevs->{ $co2->{with} };
unless( defined($ptn) and defined($plot_types->{$ptn}) ) {
barf "Unknown plot type $ptn\n";
barf "Unknown plot type $co2->{with}\n";
}

if($co2->{key} and !defined($po->{legend})) {
Expand Down
6 changes: 6 additions & 0 deletions t/simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ sub ask_yn {
unlike($a, qr/n/i, $label);
}

# error handling
eval {
PDL::Graphics::Simple::_translate_plot(undef, undef, with=>'NEVER_USED');
};
like $@, qr/unknown.*NEVER_USED/i;

##############################
# Try the simple engine and convenience interfaces...

Expand Down

0 comments on commit 0d7192c

Please sign in to comment.