File: 02_xs.t

package info (click to toggle)
libtaint-runtime-perl 0.3-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 148 kB
  • sloc: perl: 145; makefile: 8
file content (31 lines) | stat: -rw-r--r-- 724 bytes parent folder | download | duplicates (3)
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

use Test::More tests => 8;
BEGIN { use_ok('Taint::Runtime') };

Taint::Runtime->import(qw(taint_start
                          taint_enabled
                          taint
                          untaint
                          is_tainted
                          ));

ok(! taint_enabled(), "Taint is Not on yet");

taint_start();

ok(taint_enabled(), "Taint is On");

my $data = "foo";
ok(! is_tainted($data), "No false positive on is_tainted");

my $copy = taint($data);
ok(is_tainted($copy), "Made a tainted copy");

taint(\$data);
ok(is_tainted($data), "Tainted it directly");

$copy = untaint($data);
ok(! is_tainted($copy), "Made a clean copy");

untaint(\$data);
ok(! is_tainted($data), "Clean it directly");