6 use Config qw/%Config/;
9 if (!$Config{useithreads}) {
12 plan(skip_all => 'This perl wasn\'t built to support threads');
21 require Lexical::Types;
22 if (Lexical::Types::LT_THREADSAFE()) {
23 plan tests => 10 * 2 * 3 * (1 + 2);
24 defined and diag "Using threads $_" for $threads::VERSION;
26 plan skip_all => 'This Lexical::Types isn\'t thread safe';
31 package Lexical::Types::Test::Tag;
34 my $tid = threads->tid();
35 my ($file, $line) = (caller(0))[1, 2];
36 my $where = "at $file line $line in thread $tid";
37 local $Test::Builder::Level = $Test::Builder::Level + 1;
38 Test::More::is($_[0], __PACKAGE__, "base type is correct $where");
39 Test::More::is($_[2], 'Tag', "original type is correct $where");
47 use Lexical::Types as => 'Lexical::Types::Test::';
50 my $tid = threads->tid();
54 is $t, $tid, "typed lexical correctly initialized at run $_ in thread $tid";
57 use Lexical::Types as => "Lexical::Types::Test::";
59 is $t2, $tid, "typed lexical correctly initialized in eval at run $_ in thread $tid";
65 skip 'Hints aren\'t propagated into eval STRING below perl 5.10' => 3
69 is $t3, $tid, "typed lexical correctly initialized in eval (propagated) at run $_ in thread $tid"
75 my @t = map threads->create(\&try), 1 .. 10;