1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = '../lib'; 6 require './test.pl'; 7} 8 9{ # perl #116190 10 fresh_perl_is('print qq!@F!', '1 2', 11 { 12 stdin => "1:2", 13 switches => [ '-n', '-F:' ], 14 }, "passing -F implies -a"); 15 fresh_perl_is('print qq!@F!', '1 2', 16 { 17 stdin => "1:2", 18 switches => [ '-F:' ], 19 }, "passing -F implies -an"); 20 fresh_perl_is('print join q!,!, @F', '1,2', 21 { 22 stdin => "1 2", 23 switches => [ '-a' ], 24 }, "passing -a implies -n"); 25} 26 27 28my $have_config = eval { require Config; 1 }; 29SKIP: 30{ 31 $have_config or skip "Can't check if we have threads", 1; 32 $Config::Config{usethreads} or skip "No threads", 1; 33 is_miniperl() and skip "threads module not available under miniperl", 1; 34 # this would only fail under valgrind/ASAN 35 fresh_perl_is('print $F[1]; threads->new(sub {})->join', "b", 36 { 37 switches => [ "-F,", "-Mthreads" ], 38 stdin => "a,b,c", 39 }, "PL_splitstr freed in each thread"); 40} 41 42{ 43 # old value of PL_splitstr wasn't freed with multiple switches (it wasn't safe to before) 44 # this would only fail under valgrind/LSAN 45 fresh_perl_is('print $F[1]', "b", 46 { 47 switches => [ "-F:", "-F," ], 48 stdin => "a,b,c", 49 }, "PL_splitstr freed on extra -F switch"); 50} 51 52done_testing(); 53