Commit | Line | Data |
dd19458b |
1 | #!./perl |
2 | |
3 | # $Id: lock.t,v 1.0.1.1 2000/09/28 21:44:06 ram Exp $ |
4 | # |
5 | # @COPYRIGHT@ |
6 | # |
7 | # $Log: lock.t,v $ |
8 | # Revision 1.0.1.1 2000/09/28 21:44:06 ram |
9 | # patch2: created. |
10 | # |
11 | # |
12 | |
13 | sub BEGIN { |
14 | chdir('t') if -d 't'; |
15 | @INC = '.'; |
16 | push @INC, '../lib'; |
17 | require Config; import Config; |
18 | if ($Config{'extensions'} !~ /\bStorable\b/) { |
19 | print "1..0 # Skip: Storable was not built\n"; |
20 | exit 0; |
21 | } |
e4dfc136 |
22 | if (!$Config{'d_flock'} && !$Config{'d_fcntl'} && !$Config{'d_lockf'}) { |
23 | print "1..0 # Skip: no flock or flock emulation on this platform\n"; |
24 | exit 0; |
25 | } |
dd19458b |
26 | require 'lib/st-dump.pl'; |
27 | } |
28 | |
29 | sub ok; |
30 | |
31 | use Storable qw(lock_store lock_retrieve); |
32 | |
33 | print "1..5\n"; |
34 | |
35 | @a = ('first', undef, 3, -4, -3.14159, 456, 4.5); |
36 | |
37 | # |
38 | # We're just ensuring things work, we're not validating locking. |
39 | # |
40 | |
41 | ok 1, defined lock_store(\@a, 'store'); |
42 | ok 2, $dumped = &dump(\@a); |
43 | |
44 | $root = lock_retrieve('store'); |
45 | ok 3, ref $root eq 'ARRAY'; |
46 | ok 4, @a == @$root; |
47 | ok 5, &dump($root) eq $dumped; |
48 | |
49 | unlink 't/store'; |
50 | |