5 if ($ENV{'PERL_CORE'}){
7 unshift @INC, '../lib';
10 if (! $Config{'useithreads'}) {
11 print("1..0 # Skip: Perl not compiled with 'useithreads'\n");
16 use ExtUtils::testlib;
23 print("1..13\n"); ### Number of tests that will be run ###
37 # You have to do it this way or VMS will get confused.
39 print("ok $id - $name\n");
41 print("not ok $id - $name\n");
42 printf("# Failed test at line %d\n", (caller)[2]);
49 ### Start of Testing ###
54 my $wantarray = wantarray();
57 ok($context eq 'array', 'Array context');
59 } elsif (defined($wantarray)) {
60 ok($context eq 'scalar', 'Scalar context');
63 ok($context eq 'void', 'Void context');
68 my ($thr) = threads->create('foo', 'array');
69 my ($res) = $thr->join();
70 ok($res eq 'array', 'Implicit array context');
72 $thr = threads->create('foo', 'scalar');
74 ok($res eq 'scalar', 'Implicit scalar context');
76 threads->create('foo', 'void');
77 ($thr) = threads->list();
79 ok(! defined($res), 'Implicit void context');
81 $thr = threads->create({'context' => 'array'}, 'foo', 'array');
82 ($res) = $thr->join();
83 ok($res eq 'array', 'Explicit array context');
85 ($thr) = threads->create({'scalar' => 'scalar'}, 'foo', 'scalar');
87 ok($res eq 'scalar', 'Explicit scalar context');
89 $thr = threads->create({'void' => 1}, 'foo', 'void');
91 ok(! defined($res), 'Explicit void context');