File: 11-tainted.t

package info (click to toggle)
libdevel-findperl-perl 0.016-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 132 kB
  • sloc: perl: 123; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 845 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! perl -T

use strict;
use warnings;

use Test::More;

use Config;
use Devel::FindPerl qw/find_perl_interpreter perl_is_same/;

my $perlpath = $Config{perlpath};
plan(skip_all => 'Taint test can\'t be run from uninstalled perl') if $ENV{PERL_CORE};
plan(skip_all => 'Taint test can\'t be run for relocatable perl') if $Config{userelocatableinc};
plan(skip_all => 'Taint test can\'t be run for Strawberry Portable') if $INC{"Portable/Config.pm"};
plan(skip_all => "Perl not in perlpath '$perlpath'") unless -x $perlpath and perl_is_same($perlpath);
plan(skip_all => 'Testrun without taint mode') if not $^T;

my $interpreter = do {
	local $SIG{__WARN__} = sub { fail("Got a warning during find_perl_interpreter") };
	find_perl_interpreter();
};
like($interpreter, qr/\Q$perlpath/, 'Always find $Config{perlpath} under tainting');

done_testing;