File: 053_Opt_taint.t

package info (click to toggle)
libpetal-perl 2.23-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,088 kB
  • ctags: 162
  • sloc: perl: 4,738; xml: 726; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (9)
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
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
##############################################################################
# Tests the 'taint' option to Petal->new.
#

use Test::More tests => 4;

use warnings;
use lib 'lib';

use Petal;
use File::Spec;

my $data_dir = File::Spec->catdir('t', 'data');
my $file     = 'if.html';

# Confirm taint mode defaults to off

my $template = new Petal (file => $file, base_dir => $data_dir);

ok(!$template->taint, "taint mode defaults to off");


# Confirm option can enable it

$template = new Petal (file => $file, base_dir => $data_dir, taint => 1);

ok($template->taint, "taint option turns it on");


# Confirm global can enable it

$Petal::TAINT = 1;
$template = new Petal (file => $file, base_dir => $data_dir);

ok($template->taint, "\$Petal::TAINT turns it on");


# Confirm option can disable it

$template = new Petal (file => $file, base_dir => $data_dir, taint => 0);

ok(!$template->taint, "taint option turns it off again");