3 # Tests of threads::shared's behavior when threads are disabled.
9 if (($Config::Config{'extensions'} !~ /\bthreads::shared\b/) ){
10 print "1..0 # Skip -- Perl configured without threads::shared module\n";
15 # Can't use Test::More, it turns threads on.
21 # Make sure threads are really off.
22 ok( !$INC{"threads.pm"} );
24 # Check each faked function.
25 foreach my $func (qw(share cond_wait cond_signal cond_broadcast)) {
26 ok( my $func_ref = __PACKAGE__->can($func) ? 1 : 0 );
29 ok( $@, qr/^Not enough arguments / );
31 my %hash = (foo => 42, bar => 23);
32 eval qq{$func(\%hash)};
38 # These all have no return value.
39 foreach my $func (qw(cond_wait cond_signal cond_broadcast)) {
40 my @array = qw(1 2 3 4);
41 ok( eval qq{$func(\@array)}, undef );
42 ok( "@array", "1 2 3 4" );
45 # share() is supposed to return back it's argument as a ref.
47 my @array = qw(1 2 3 4);
48 ok( share(@array), \@array );
49 ok( ref &share({}), 'HASH' );
50 ok( "@array", "1 2 3 4" );
53 # lock() should be a no-op. The return value is currently undefined.
55 my @array = qw(1 2 3 4);
57 ok( "@array", "1 2 3 4" );