7 use VPIT::TestHelpers (
8 threads => [ 'autovivification' => 'autovivification::A_THREADSAFE()' ],
20 my $tid = threads->tid();
22 for my $run (1 .. $runs) {
26 is $x, undef, "fetch does not autovivify at thread $tid run $run";
30 my $y = exists $x->{foo};
31 is $x, undef, "exists does not autovivify at thread $tid run $run";
35 my $y = delete $x->{foo};
36 is $x, undef, "delete does not autovivify at thread $tid run $run";
41 skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3 * 2
45 eval 'my $y = $x->{foo}';
46 is $@, '', "fetch in eval does not croak at thread $tid run $run";
47 is $x, undef, "fetch in eval does not autovivify at thread $tid run $run";
51 eval 'my $y = exists $x->{foo}';
52 is $@, '', "exists in eval does not croak at thread $tid run $run";
53 is $x, undef, "exists in eval does not autovivify at thread $tid run $run";
57 eval 'my $y = delete $x->{foo}';
58 is $@, '', "delete in eval does not croak at thread $tid run $run";
59 is $x, undef, "delete in eval does not autovivify at thread $tid run $run";
66 my @threads = map spawn(\&try), 1 .. $threads;
68 $_->join for @threads;