This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade Scalar-List-Utils from 1.46 to 1.47
[perl5.git] / cpan / Scalar-List-Utils / t / tainted.t
1 #!./perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 5;
7
8 use Scalar::Util qw(tainted);
9
10 ok( !tainted(1), 'constant number');
11
12 my $var = 2;
13
14 ok( !tainted($var), 'known variable');
15
16 ok( tainted($^X),       'interpreter variable');
17
18 $var = $^X;
19 ok( tainted($var),      'copy of interpreter variable');
20
21 {
22     package Tainted;
23     sub TIESCALAR { bless {} }
24     sub FETCH { $^X }
25 }
26
27 tie my $tiedvar, 'Tainted';
28 ok( tainted($tiedvar), 'for magic variables');