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
46
47
48
49
50
51
52
|
#!./perl
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
}
{ # perl #116190
fresh_perl_is('print qq!@F!', '1 2',
{
stdin => "1:2",
switches => [ '-n', '-F:' ],
}, "passing -F implies -a");
fresh_perl_is('print qq!@F!', '1 2',
{
stdin => "1:2",
switches => [ '-F:' ],
}, "passing -F implies -an");
fresh_perl_is('print join q!,!, @F', '1,2',
{
stdin => "1 2",
switches => [ '-a' ],
}, "passing -a implies -n");
}
my $have_config = eval { require Config; 1 };
SKIP:
{
$have_config or skip "Can't check if we have threads", 1;
$Config::Config{usethreads} or skip "No threads", 1;
is_miniperl() and skip "threads module not available under miniperl", 1;
# this would only fail under valgrind/ASAN
fresh_perl_is('print $F[1]; threads->new(sub {})->join', "b",
{
switches => [ "-F,", "-Mthreads" ],
stdin => "a,b,c",
}, "PL_splitstr freed in each thread");
}
{
# old value of PL_splitstr wasn't freed with multiple switches (it wasn't safe to before)
# this would only fail under valgrind/LSAN
fresh_perl_is('print $F[1]', "b",
{
switches => [ "-F:", "-F," ],
stdin => "a,b,c",
}, "PL_splitstr freed on extra -F switch");
}
done_testing();
|