Commit | Line | Data |
dd19458b |
1 | #!./perl |
2 | |
212e9bde |
3 | # $Id: lock.t,v 1.0.1.3 2000/10/26 17:11:27 ram Exp ram $ |
dd19458b |
4 | # |
5 | # @COPYRIGHT@ |
6 | # |
7 | # $Log: lock.t,v $ |
212e9bde |
8 | # Revision 1.0.1.3 2000/10/26 17:11:27 ram |
9 | # patch5: just check $^O, there's no need for the whole Config |
10 | # |
b29b780f |
11 | # Revision 1.0.1.2 2000/10/23 18:03:07 ram |
12 | # patch4: protected calls to flock() for dos platform |
13 | # |
dd19458b |
14 | # Revision 1.0.1.1 2000/09/28 21:44:06 ram |
15 | # patch2: created. |
16 | # |
17 | # |
18 | |
19 | sub BEGIN { |
20 | chdir('t') if -d 't'; |
b29b780f |
21 | @INC = '.'; |
dd19458b |
22 | push @INC, '../lib'; |
23 | require Config; import Config; |
24 | if ($Config{'extensions'} !~ /\bStorable\b/) { |
25 | print "1..0 # Skip: Storable was not built\n"; |
26 | exit 0; |
27 | } |
e4dfc136 |
28 | if (!$Config{'d_flock'} && !$Config{'d_fcntl'} && !$Config{'d_lockf'}) { |
29 | print "1..0 # Skip: no flock or flock emulation on this platform\n"; |
30 | exit 0; |
31 | } |
b542dcd5 |
32 | if ($^O eq 'dos') { |
33 | print "1..0 # Skip: fcntl/flock emulation broken on this platform\n"; |
34 | exit 0; |
35 | } |
dd19458b |
36 | require 'lib/st-dump.pl'; |
37 | } |
38 | |
39 | sub ok; |
40 | |
41 | use Storable qw(lock_store lock_retrieve); |
42 | |
43 | print "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 | |
51 | ok 1, defined lock_store(\@a, 'store'); |
52 | ok 2, $dumped = &dump(\@a); |
53 | |
54 | $root = lock_retrieve('store'); |
55 | ok 3, ref $root eq 'ARRAY'; |
56 | ok 4, @a == @$root; |
57 | ok 5, &dump($root) eq $dumped; |
58 | |
59 | unlink 't/store'; |
60 | |