7 use autovivification::TestThreads;
18 my $tid = threads->tid();
20 for my $run (1 .. $runs) {
24 is $x, undef, "fetch does not autovivify at thread $tid run $run";
28 my $y = exists $x->{foo};
29 is $x, undef, "exists does not autovivify at thread $tid run $run";
33 my $y = delete $x->{foo};
34 is $x, undef, "delete does not autovivify at thread $tid run $run";
39 skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3 * 2
43 eval 'my $y = $x->{foo}';
44 is $@, '', "fetch in eval does not croak at thread $tid run $run";
45 is $x, undef, "fetch in eval does not autovivify at thread $tid run $run";
49 eval 'my $y = exists $x->{foo}';
50 is $@, '', "exists in eval does not croak at thread $tid run $run";
51 is $x, undef, "exists in eval does not autovivify at thread $tid run $run";
55 eval 'my $y = delete $x->{foo}';
56 is $@, '', "delete in eval does not croak at thread $tid run $run";
57 is $x, undef, "delete in eval does not autovivify at thread $tid run $run";
64 my @threads = map spawn(\&try), 1 .. $threads;
66 $_->join for @threads;
70 done_testing(scalar(@threads) * $runs * 3 * (1 + 2) + 1);