X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FLexical-Types.git;a=blobdiff_plain;f=t%2F81-threads-teardown.t;h=7a5c2270268a3df0b335a154fc532d4b3a872bb9;hp=c60e14f1aa1695f0d3c4b01b8b7dacd8c3913e45;hb=cb00fbfded7c20f01c75b520c5e5d2b582e2d4be;hpb=b99a3bce46a7a325bfe18ce349df5cd80bdbc78f diff --git a/t/81-threads-teardown.t b/t/81-threads-teardown.t index c60e14f..7a5c227 100644 --- a/t/81-threads-teardown.t +++ b/t/81-threads-teardown.t @@ -7,7 +7,7 @@ use lib 't/lib'; use VPIT::TestHelpers; use Lexical::Types::TestThreads; -use Test::More tests => 1; +use Test::More tests => 2; { my $status = run_perl <<' RUN'; @@ -32,3 +32,21 @@ use Test::More tests => 1; RUN is $status, 0, 'loading the pragma in a thread and using it outside doesn\'t segfault'; } + +{ + my $status = run_perl <<' RUN'; + use threads; + BEGIN { require Lexical::Types; } + sub X::DESTROY { + eval 'use Lexical::Types; package Z; my Z $z = 1'; + exit 1 if $@; + } + threads->create(sub { + my $x = bless { }, 'X'; + $x->{self} = $x; + return; + })->join; + exit 0; + RUN + is $status, 0, 'Lexical::Types can be loaded in eval STRING during global destruction at the end of a thread'; +}