| 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 |
|
|---|
| 16 | BEGIN {
|
|---|
| 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 |
|
|---|
| 26 | use ExtUtils::testlib;
|
|---|
| 27 | use strict;
|
|---|
| 28 | BEGIN { $| = 1; print "1..19\n" };
|
|---|
| 29 | use threads;
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
|
|---|
| 33 | print "ok 1\n";
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | #########################
|
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | sub 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 |
|
|---|
| 54 | sub test1 {
|
|---|
| 55 | ok(2,'bar' eq $_[0],"Test that argument passing works");
|
|---|
| 56 | }
|
|---|
|
|---|