3 # Tests of threads::shared's behavior when threads are disabled.
10 # Can't use Test::More, it turns threads on.
16 # Make sure threads are really off.
17 ok( !$INC{"threads.pm"} );
19 # Check each faked function.
20 foreach my $func (qw(share cond_wait cond_signal cond_broadcast)) {
21 ok( my $func_ref = __PACKAGE__->can($func) ? 1 : 0 );
24 ok( $@, qr/^Not enough arguments / );
26 my %hash = (foo => 42, bar => 23);
27 eval qq{$func(\%hash)};
33 # These all have no return value.
34 foreach my $func (qw(cond_wait cond_signal cond_broadcast)) {
35 my @array = qw(1 2 3 4);
36 ok( eval qq{$func(\@array)}, undef );
37 ok( "@array", "1 2 3 4" );
40 # share() is supposed to return back it's argument as a ref.
42 my @array = qw(1 2 3 4);
43 ok( share(@array), \@array );
44 ok( ref &share({}), 'HASH' );
45 ok( "@array", "1 2 3 4" );
48 # lock() should be a no-op. The return value is currently undefined.
50 my @array = qw(1 2 3 4);
52 ok( "@array", "1 2 3 4" );