This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Refactor skip_all_without_config() to take a list of config options to test.
authorNicholas Clark <nick@ccl4.org>
Tue, 8 Mar 2011 10:46:14 +0000 (10:46 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 8 Mar 2011 10:46:14 +0000 (10:46 +0000)
Previously it took a second argument as a reason to show in the skip_all
message, if the config option was not set. However, no callers were using it,
so remove it. This allows skip_all_without_config() to take a list of keys
to test, which is useful to two of its callers.

t/op/getpid.t
t/op/getppid.t
t/test.pl

index a06a0c6..7c1c042 100644 (file)
@@ -12,7 +12,7 @@ use strict;
 use Config;
 
 BEGIN {
-    skip_all_without_config($_) foreach qw(useithreads d_getppid);
+    skip_all_without_config(qw(useithreads d_getppid));
     skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
     eval 'use threads; use threads::shared';
     plan tests => 3;
index 23428f0..a631610 100644 (file)
@@ -16,7 +16,7 @@ use strict;
 
 BEGIN {
     require './test.pl';
-    skip_all_without_config($_) foreach qw(d_pipe d_fork d_waitpid d_getppid);
+    skip_all_without_config(qw(d_pipe d_fork d_waitpid d_getppid));
     plan (8);
 }
 
index fa151ec..01035af 100644 (file)
--- a/t/test.pl
+++ b/t/test.pl
@@ -137,18 +137,17 @@ sub skip_all_without_perlio {
 }
 
 sub skip_all_without_config {
-    my ($key, $reason) = @_;
     unless (eval 'require Config; 1') {
        warn "test.pl had problems loading Config: $@";
        return;
     }
-    return if $Config::Config{$key};
-    unless (defined $reason) {
+    foreach (@_) {
+       next if $Config::Config{$_};
+       my $key = $_; # Need to copy, before trying to modify.
        $key =~ s/^use//;
        $key =~ s/^d_//;
-       $reason = "no $key";
+       skip_all("no $key");
     }
-    skip_all($reason);
 }
 
 sub _ok {