diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-03-08 10:46:14 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-03-08 10:46:14 +0000 |
commit | 77ba2250b324d4fdc54cedfc356f3197ea6cc717 (patch) | |
tree | abdb0a19ccef6d31455fdc7ee7722b173066ecd9 | |
parent | 4f018ed094fde8223d458959a30ea42ff841f880 (diff) | |
download | perl-77ba2250b324d4fdc54cedfc356f3197ea6cc717.tar.gz |
Refactor skip_all_without_config() to take a list of config options to test.
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.
-rw-r--r-- | t/op/getpid.t | 2 | ||||
-rw-r--r-- | t/op/getppid.t | 2 | ||||
-rw-r--r-- | t/test.pl | 9 |
3 files changed, 6 insertions, 7 deletions
diff --git a/t/op/getpid.t b/t/op/getpid.t index a06a0c6c3b..7c1c04264b 100644 --- a/t/op/getpid.t +++ b/t/op/getpid.t @@ -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; diff --git a/t/op/getppid.t b/t/op/getppid.t index 23428f0df7..a63161014a 100644 --- a/t/op/getppid.t +++ b/t/op/getppid.t @@ -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); } @@ -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 { |