blob: 64f0e559a63af192ef465eed340cd6f43f24777b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!perl
use strict;
use warnings;
BEGIN {
use Config;
if ($Config{extensions} !~ /\bEncode\b/) {
print "1..0 # Skip: no Encode\n";
exit 0;
}
unless ($Config{useithreads}) {
print "1..0 # Skip: no threads\n";
exit 0;
}
}
use threads;
use Test::More tests => 3 + 1;
binmode *STDOUT, ':encoding(UTF-8)';
SKIP: {
local $@;
my $ret = eval {
my $thread = threads->create(sub { pass 'in thread'; return 1 });
skip 'test thread could not be spawned' => 3 unless $thread;
$thread->join;
};
is $@, '', 'thread did not croak';
is $ret, 1, 'thread returned the right value';
}
pass 'passes at least one test';
|