summaryrefslogtreecommitdiff
path: root/t/test.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-03-06 21:58:19 +0000
committerNicholas Clark <nick@ccl4.org>2011-03-06 22:48:16 +0000
commit7465bc322e5c5dcbd256bb5fbdd3135163fb3dc1 (patch)
tree03dcd93e4a3ae2b625c5c44c07419cc159d2ba45 /t/test.pl
parent21da8bce185d89ceb57f48bde4bcb5679ce4d106 (diff)
downloadperl-7465bc322e5c5dcbd256bb5fbdd3135163fb3dc1.tar.gz
Add skip_all_without_extension() to test.pl, for the common skip idiom.
Use it in t/io/layers.t to skip if Encode is not built.
Diffstat (limited to 't/test.pl')
-rw-r--r--t/test.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/test.pl b/t/test.pl
index 5eed21dd52..9958356285 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -122,6 +122,16 @@ sub skip_all_if_miniperl {
skip_all(@_) if is_miniperl();
}
+sub skip_all_without_extension {
+ my $extension = shift;
+ unless (eval 'require Config; 1') {
+ warn "test.pl had problems loading Config: $@";
+ return;
+ }
+ return if ($Config::Config{extensions} =~ /\b$extension\b/);
+ skip_all("$extension was not built");
+}
+
sub _ok {
my ($pass, $where, $name, @mess) = @_;
# Do not try to microoptimize by factoring out the "not ".