Avoid criticizable perl code
Using `require` / `->import` instead of `use` avoids the use of a "stringy eval", making for cleaner code that we don't need to silence perlcritic about. Per Andrew Dunstan Discussion: https://postgr.es/m/7cd3bbbd-0216-4436-d571-8f80c9259a07@dunslane.net
This commit is contained in:
parent
d00a4ad1d5
commit
590a075789
@ -9,16 +9,16 @@ use PostgreSQL::Test::Utils;
|
|||||||
use Test::More;
|
use Test::More;
|
||||||
|
|
||||||
# Use Test::Differences if installed, and select unified diff output.
|
# Use Test::Differences if installed, and select unified diff output.
|
||||||
# No decent way to select a context line count with this;
|
|
||||||
# we could use a sub ref to allow that.
|
|
||||||
BEGIN
|
BEGIN
|
||||||
{
|
{
|
||||||
#<<< protect next line from pgperltidy
|
eval {
|
||||||
if (!eval q{ use Test::Differences; unified_diff(); 1 }) ## no critic (ProhibitStringyEval)
|
require Test::Differences;
|
||||||
#>>>
|
Test::Differences->import;
|
||||||
{
|
unified_diff();
|
||||||
*eq_or_diff = \&is;
|
};
|
||||||
}
|
|
||||||
|
# No dice -- fall back to 'is'
|
||||||
|
*eq_or_diff = \&is if $@;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $node = PostgreSQL::Test::Cluster->new('main');
|
my $node = PostgreSQL::Test::Cluster->new('main');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user