Fix the bug ID 20001024.005, the bug introduced by #7416.
[p5sagit/p5-mst-13.2.git] / t / lib / st-lock.t
CommitLineData
dd19458b 1#!./perl
2
b29b780f 3# $Id: lock.t,v 1.0.1.2 2000/10/23 18:03:07 ram Exp ram $
dd19458b 4#
5# @COPYRIGHT@
6#
7# $Log: lock.t,v $
b29b780f 8# Revision 1.0.1.2 2000/10/23 18:03:07 ram
9# patch4: protected calls to flock() for dos platform
10#
dd19458b 11# Revision 1.0.1.1 2000/09/28 21:44:06 ram
12# patch2: created.
13#
14#
15
b29b780f 16use Config;
17
18if ($Config{'osname'} eq 'dos') {
19 print "1..0 # Skip: fcntl/flock emulation broken on this platform\n";
20 exit 0;
21}
22
dd19458b 23sub BEGIN {
24 chdir('t') if -d 't';
b29b780f 25 @INC = '.';
dd19458b 26 push @INC, '../lib';
27 require Config; import Config;
28 if ($Config{'extensions'} !~ /\bStorable\b/) {
29 print "1..0 # Skip: Storable was not built\n";
30 exit 0;
31 }
e4dfc136 32 if (!$Config{'d_flock'} && !$Config{'d_fcntl'} && !$Config{'d_lockf'}) {
33 print "1..0 # Skip: no flock or flock emulation on this platform\n";
34 exit 0;
35 }
dd19458b 36 require 'lib/st-dump.pl';
37}
38
39sub ok;
40
41use Storable qw(lock_store lock_retrieve);
42
43print "1..5\n";
44
45@a = ('first', undef, 3, -4, -3.14159, 456, 4.5);
46
47#
48# We're just ensuring things work, we're not validating locking.
49#
50
51ok 1, defined lock_store(\@a, 'store');
52ok 2, $dumped = &dump(\@a);
53
54$root = lock_retrieve('store');
55ok 3, ref $root eq 'ARRAY';
56ok 4, @a == @$root;
57ok 5, &dump($root) eq $dumped;
58
59unlink 't/store';
60