]> git.vpit.fr Git - perl/modules/Lexical-Types.git/blobdiff - t/30-threads.t
Use a pointer table allocated on shared memory
[perl/modules/Lexical-Types.git] / t / 30-threads.t
index 32bdf8039ae3205f903d791496204cd65c05ad05..5c4b8d1710a3f587a552b6f3e1d8dfa404bf3edc 100644 (file)
@@ -15,15 +15,17 @@ BEGIN {
 
 use threads;
 
-use Test::More tests => 10 * 2 * (1 + 2);
+use Test::More tests => 10 * 2 * 2 * (1 + 2);
 
 {
  package Lexical::Types::Test::Tag;
 
  sub TYPEDSCALAR {
   my $tid = threads->tid();
-  Test::More::is($_[0], __PACKAGE__, "base type is correct in thread $tid");
-  Test::More::is($_[2], 'Tag', "original type is correct in thread $tid");
+  my ($file, $line) = (caller(0))[1, 2];
+  my $where = "at $file line $line in thread $tid";
+  Test::More::is($_[0], __PACKAGE__, "base type is correct $where");
+  Test::More::is($_[2], 'Tag', "original type is correct $where");
   $_[1] = $tid;
   ();
  }
@@ -34,10 +36,18 @@ use Test::More tests => 10 * 2 * (1 + 2);
 use Lexical::Types as => 'Lexical::Types::Test::';
 
 sub try {
+ my $tid = threads->tid();
+
  for (1 .. 2) {
   my Tag $t;
-  my $tid = threads->tid();
   is $t, $tid, "typed lexical correctly initialized at run $_ in thread $tid";
+
+  eval <<'EVALD';
+   use Lexical::Types as => "Lexical::Types::Test::";
+   my Tag $t2;
+   is $t2, $tid, "typed lexical correctly initialized in eval at run $_ in thread $tid";
+EVALD
+  diag $@ if $@;
  }
 }