use VPIT::TestHelpers;
use Lexical::Types::TestThreads;
-use Test::More tests => 1;
+use Test::More tests => 2;
{
my $status = run_perl <<' RUN';
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';
+}