6 require Config; import Config;
7 unless ($Config{'useithreads'}) {
8 print "1..0 # Skip: no useithreads\n";
15 my ($id, $ok, $name) = @_;
17 $name = '' unless defined $name;
18 # You have to do it this way or VMS will get confused.
19 print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
21 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
27 use ExtUtils::testlib;
29 BEGIN { print "1..10\n" };
41 ok(2,my $temp1 = $@ =~/^Invalid\b.*shared scalar/, "Wrong error message");
44 ok(3, $temp1 = $foo =~/SCALAR/, "Check that is a ref");
45 ok(4, $$foo eq "foo", "Check that it points to the correct value");
47 ok(5, $$foo eq "yeah", "Check that assignment works");
49 ok(6, $$foo eq "yeah2", "Check that deref assignment works");
50 threads->create(sub {$bar = "yeah3"})->join();
51 ok(7, $$foo eq "yeah3", "Check that other thread assignemtn works");
52 threads->create(sub {$foo = "artur"})->join();
53 ok(8, $foo eq "artur", "Check that uncopupling the ref works");
59 ok(9,$$$foo eq 'original', "Check reference chain");
65 threads->create(sub { $t1 = "bar" })->join();
66 ok(10,$t1 eq 'bar',"Check that assign to a ROK works");