File: tainted_ok_deeply.t

package info (click to toggle)
libtest-taint-perl 1.06-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 168 kB
  • ctags: 126
  • sloc: perl: 499; makefile: 3
file content (33 lines) | stat: -rw-r--r-- 605 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!perl -T

use strict;
use warnings FATAL => 'all';
use Test::More;
use Test::Taint tests => 8;

taint_checking_ok('Taint checking is on');

my %vars = (
    HASH   => { key => 'value' },
    ARRAY  => [ 1..2 ],
    GLOB   => \*DATA,
    SCALAR => \q{u can't taint this},
    REF    => \{ another_key => 1 },
);

while(my($key, $value) = each %vars) {
  is(
    ref $value,
    $key,
    'Make sure the datatype is correct',
  );
}

untainted_ok_deeply( \%vars, 'Everything should be untainted' );

taint_deeply( \%vars );

tainted_ok_deeply( \%vars, 'Everything should be tainted' );

__DATA__
i am glob