OP_RCATLINE is an SVOP, not a BASEOP.
[p5sagit/p5-mst-13.2.git] / ext / threads / t / basic.t
CommitLineData
47ba8780 1# Before `make install' is performed this script should be runnable with
2# `make test'. After `make install' it should work as `perl test.pl'
3
4#########################
5
6# change 'tests => 1' to 'tests => last_test_to_print';
7use ExtUtils::testlib;
8use Test;
9use strict;
10BEGIN { plan tests => 16 };
11use threads;
12
13
14ok(1); # If we made it this far, we're ok.
15
16#########################
17
18# Insert your test code below, the Test module is use()ed here so read
19# its man page ( perldoc Test ) for help writing this test script.
20#my $bar;
21
22skip('The ignores are here to keep test numbers correct','The ignores are here to keep test numbers correct');
23
24#test passing of simple argument
25my $thread = threads->create(sub { ok('bar',$_[0]) },"bar");
26$thread->join();
27skip('Ignore','Ignore');
28
29#test passing of complex argument
30
31$thread = threads->create(sub { ok('bar',$_[0]->[0]->{foo})},[{foo => 'bar'}]);
32
33$thread->join();
34skip('Ignore','Ignore');
35
36#test execuion of normal sub
37sub bar { ok(1,shift()) }
38threads->create(\&bar,1)->join();
39skip('Ignore','Ignore');
40
41#check Config
42ok("1", "$Config::threads");
43
44#test trying to detach thread
45
46my $thread1 = threads->create(sub {ok(1);});
47
48$thread1->detach();
49skip('Ignore','Ignore');
50sleep 1;
51ok(1);
52#create nested threads
53unless($^O eq 'MSWin32') {
54 my $thread3 = threads->create(sub { threads->create(sub {})})->join();
55 ok(1);
56} else {
57 skip('thread trees are unsafe under win32','thread trees are unsafe under win32');
58}
59skip('Ignore','Ignore');
60
61my @threads;
62my $i;
63unless($^O eq 'MSWin32') {
64for(1..25) {
65 push @threads, threads->create(sub { for(1..100000) { my $i } threads->create(sub { sleep 2})->join() });
66}
67foreach my $thread (@threads) {
68 $thread->join();
69}
70}
71ok(1);
72threads->create(sub {
73 my $self = threads->self();
74 ok($self->tid(),57);
75})->join();
76skip('Ignore','Ignore');
77threads->create(sub {
78 my $self = threads->self();
79 ok($self->tid(),58);
80})->join();
81skip('Ignore','Ignore');
82
83#check support for threads->self() in main thread
84ok(0,threads->self->tid());
85ok(0,threads->tid());
86
87
88
89
90
91
92
93
94
95