File: taint.t

package info (click to toggle)
libdatetime-locale-perl 1%3A1.37-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,856 kB
  • sloc: perl: 225,932; sh: 23; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 496 bytes parent folder | download | duplicates (2)
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
#!perl -T

use strict;
use warnings;

use Scalar::Util 'tainted';
use Test2::V0;

use DateTime::Locale;

skip_all 'Taint mode is not enabled' unless ${^TAINT};

# Concat code with zero bytes of executable name in order to taint it.
my $code = 'en-GB' . substr $^X, 0, 0;

ok( tainted($code), '$code is tainted' );

try_ok(
    sub {
        is(
            DateTime::Locale->load($code)->code, $code,
            'loaded correct code'
        );
    },
    'tainted load lives'
);

done_testing;