Simplify version check for SKIP clause
authorDaniel Gustafsson <[email protected]>
Sat, 8 Apr 2023 21:32:11 +0000 (23:32 +0200)
committerDaniel Gustafsson <[email protected]>
Sat, 8 Apr 2023 21:32:11 +0000 (23:32 +0200)
Checking for the required versions of IO::Pty as well as IPC::Run
can be achieved with a single eval call, and by using the VERSION
function the comparison is guaranteed to follow the same rules as
calling 'use' on the module with a version.

Reported-by: Andrew Dunstan <[email protected]>
Discussion: https://postgr.es/m/6d880ea2-f8ca-f458-4dcd-a7a3e6d6cd7c@dunslane.net

src/test/authentication/t/001_password.pl

index 10ebe014d69ca7ca119a3fbca944c6411c6b7239..d7362a4d3edd5c5f31ba7c6f88661ad773b17a22 100644 (file)
@@ -107,7 +107,7 @@ is($res, 'SCRAM-SHA-256$1024:', 'scram_iterations in server side ROLE');
 SKIP:
 {
    skip "IO::Pty and IPC::Run >= 0.98 required", 1 unless
-       (eval { require IO::Pty; } && eval { $IPC::Run::VERSION >= '0.98' });
+       eval { require IO::Pty; IPC::Run->VERSION('0.98'); };
 
    # Alter the password on the created role using \password in psql to ensure
    # that clientside password changes use the scram_iterations value when