Skip to content

Commit

Permalink
put error-check tests first to avoid skip_all giving "UNKNOWN" results
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Sep 24, 2024
1 parent 8229333 commit 4a5bda3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- adjust tests to avoid spurious "UNKNOWN" results

1.012 2024-09-21
- add "contours", "fits", "polylines" plot types

Expand Down
24 changes: 14 additions & 10 deletions t/simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ sub ask_yn {
unlike($a, qr/n/i, $label);
}

# first so no "bad plan" if skip_all
{
my @new = eval {PDL::Graphics::Simple::_translate_new()};
diag(join '',explain $PDL::Graphics::Simple::mods), plan skip_all => 'No plotting engines installed' if $@ =~ /Sorry, all known/;
# ignore $engine
is_deeply $new[1], {
'multi' => undef, 'output' => '', 'size' => [ 8, 6, 'in' ], 'type' => 'i'
} or diag explain \@new;
}

# error handling
eval {
PDL::Graphics::Simple::_translate_plot(undef, undef, with=>'line', undef);
Expand Down Expand Up @@ -66,6 +56,20 @@ like $@, qr/Single-arg/;
is "@w", "", "no warnings";
}

{
my @new = eval {PDL::Graphics::Simple::_translate_new()};
if ($@ =~ /Sorry, all known/) {
diag(join '',explain $PDL::Graphics::Simple::mods);
ok 1, 'No plotting engines installed, stopping';
done_testing;
exit 0;
}
# ignore $engine
is_deeply $new[1], {
'multi' => undef, 'output' => '', 'size' => [ 8, 6, 'in' ], 'type' => 'i'
} or diag explain \@new;
}

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

Expand Down

0 comments on commit 4a5bda3

Please sign in to comment.