diff options
author | 2014-11-17 20:52:31 +0000 | |
---|---|---|
committer | 2014-11-17 20:52:31 +0000 | |
commit | 6fb12b7054efc6b436584db6cef9c2f85c0d7e27 (patch) | |
tree | aa09a524574ec7ae2f521a24573deeecb78ff66a /gnu/usr.bin/perl/cpan/Module-Metadata/t/taint.t | |
parent | Add the Cammelia cipher to libcrypto. (diff) | |
download | wireguard-openbsd-6fb12b7054efc6b436584db6cef9c2f85c0d7e27.tar.xz wireguard-openbsd-6fb12b7054efc6b436584db6cef9c2f85c0d7e27.zip |
Import perl-5.20.1
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Module-Metadata/t/taint.t')
-rw-r--r-- | gnu/usr.bin/perl/cpan/Module-Metadata/t/taint.t | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/cpan/Module-Metadata/t/taint.t b/gnu/usr.bin/perl/cpan/Module-Metadata/t/taint.t new file mode 100644 index 00000000000..ef527de50d1 --- /dev/null +++ b/gnu/usr.bin/perl/cpan/Module-Metadata/t/taint.t @@ -0,0 +1,29 @@ +#!/usr/bin/perl -T +use strict; +use warnings; + +use 5.008000; # for ${^TAINT} +use Test::More tests => 2; +use Module::Metadata; +use Carp 'croak'; + +# stolen liberally from Class-Tiny/t/lib/TestUtils.pm - thanks xdg! +sub exception(&) { + my $code = shift; + my $success = eval { $code->(); 1 }; + my $err = $@; + return undef if $success; # original returned '' + croak "Execution died, but the error was lost" unless $@; + return $@; +} + +ok(${^TAINT}, 'taint flag is set'); + +# without the fix, we get: +# Insecure dependency in eval while running with -T switch at lib/Module/Metadata.pm line 668, <GEN0> line 15. +is( + exception { Module::Metadata->new_from_module( "Module::Metadata" )->version }, + undef, + 'no exception', +); + |