Commit | Line | Data |
5ae49e26 |
1 | #!/usr/bin/perl -T |
2 | use strict; |
3 | use warnings; |
4 | |
dcddf99e |
5 | use Test::More tests => 2; |
5ae49e26 |
6 | use Module::Metadata; |
dcddf99e |
7 | use Carp 'croak'; |
8 | |
9 | # stolen liberally from Class-Tiny/t/lib/TestUtils.pm - thanks xdg! |
10 | sub exception(&) { |
11 | my $code = shift; |
12 | my $success = eval { $code->(); 1 }; |
13 | my $err = $@; |
14 | return undef if $success; # original returned '' |
15 | croak "Execution died, but the error was lost" unless $@; |
16 | return $@; |
17 | } |
5ae49e26 |
18 | |
698048aa |
19 | my $taint_on = ! eval { no warnings; join('',values %ENV), kill 0; 1; }; |
20 | ok($taint_on, 'taint flag is set'); |
5ae49e26 |
21 | |
22 | # without the fix, we get: |
23 | # Insecure dependency in eval while running with -T switch at lib/Module/Metadata.pm line 668, <GEN0> line 15. |
24 | is( |
25 | exception { Module::Metadata->new_from_module( "Module::Metadata" )->version }, |
26 | undef, |
27 | 'no exception', |
28 | ); |
29 | |