File: release-pp-29-taint-mode.t

package info (click to toggle)
libparams-validate-perl 1.06-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 776 kB
  • sloc: perl: 2,179; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 742 bytes parent folder | download
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


use Test::More;

BEGIN {
    unless ( $ENV{RELEASE_TESTING} ) {
        plan skip_all => 'these tests are for testing by the release';
    }

    $ENV{PV_TEST_PERL} = 1;
}

use strict;
use warnings;

use Test::More;

plan skip_all => 'This test is flaky';

use Params::Validate qw( validate );

sub test {
    my $def = $0;

    # The spec is irrelevant, all that matters is that there's a
    # tainted scalar as the default
    my %p = validate( @_, { foo => { default => $def } } );
}

TODO:
{
    local $TODO = 'I cannot figure out how to prevent this error in XS mode'
        unless $ENV{PV_TEST_PERL};

    eval { test() };
    is(
        $@, '',
        'no taint error when we validate with tainted value in caller sub'
    );
}