source: trunk/essentials/dev-lang/perl/ext/threads/t/basic.t@ 3403

Last change on this file since 3403 was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 2.8 KB
Line 
1
2
3#
4# The reason this does not use a Test module is that
5# they mess up test numbers between threads
6#
7# And even when that will be fixed, this is a basic
8# test and should not rely on shared variables
9#
10# This will test the basic API, it will not use any coderefs
11# as they are more advanced
12#
13#########################
14
15
16BEGIN {
17 chdir 't' if -d 't';
18 push @INC, '../lib';
19 require Config; import Config;
20 unless ($Config{'useithreads'}) {
21 print "1..0 # Skip: no useithreads\n";
22 exit 0;
23 }
24}
25
26use ExtUtils::testlib;
27use strict;
28BEGIN { $| = 1; print "1..19\n" };
29use threads;
30
31
32
33print "ok 1\n";
34
35
36#########################
37
38
39
40
41sub ok {
42 my ($id, $ok, $name) = @_;
43
44 # You have to do it this way or VMS will get confused.
45 print $ok ? "ok $id - $name\n" : "not ok $id - $name\n";
46
47 printf "# Failed test at line %d\n", (caller)[2] unless $ok;
48
49 return $ok;
50}
51
52
53
54sub test1 {
55 ok(2,'bar' eq $_[0],"Test that argument passing works");
56}