7 use VPIT::TestHelpers (
8 threads => [ 'autovivification' => 'autovivification::A_THREADSAFE()' ],
12 use Test::Leaner tests => 2;
16 skip 'Fails on 5.8.2 and lower' => 1 if "$]" <= 5.008_002;
18 my $status = run_perl <<' RUN';
21 $code -= threads->create(sub {
22 eval q{no autovivification; my $x; my $y = $x->{foo}; $x};
23 return defined($x) ? 0 : 1;
25 $code -= defined(eval q{my $x; my $y = $x->{foo}; $x}) ? 2 : 0;
26 $code -= defined(eval q{no autovivification; my $x; my $y = $x->{foo}; $x})
30 skip RUN_PERL_FAILED() => 1 unless defined $status;
32 'loading the pragma in a thread and using it outside doesn\'t segfault';
36 my $status = run_perl <<' RUN';
38 BEGIN { require autovivification; }
40 eval 'no autovivification; my $x; my $y = $x->{foo}{bar}; use autovivification; my $z = $x->{a}{b}{c};';
44 my $x = bless { }, 'X';
50 skip RUN_PERL_FAILED() => 1 unless defined $status;
51 is $status, 0, 'autovivification can be loaded in eval STRING during global destruction at the end of a thread';