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'; |
f567092b |
15 | @INC = '.'; |
dd19458b |
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 | } |
f567092b |
26 | if ($Config{'osname'} eq 'dos') { |
27 | print "1..0 # Skip: fcntl/flock emulation broken on this platform\n"; |
28 | exit 0; |
29 | } |
dd19458b |
30 | require 'lib/st-dump.pl'; |
31 | } |
32 | |
33 | sub ok; |
34 | |
35 | use Storable qw(lock_store lock_retrieve); |
36 | |
37 | print "1..5\n"; |
38 | |
39 | @a = ('first', undef, 3, -4, -3.14159, 456, 4.5); |
40 | |
41 | # |
42 | # We're just ensuring things work, we're not validating locking. |
43 | # |
44 | |
45 | ok 1, defined lock_store(\@a, 'store'); |
46 | ok 2, $dumped = &dump(\@a); |
47 | |
48 | $root = lock_retrieve('store'); |
49 | ok 3, ref $root eq 'ARRAY'; |
50 | ok 4, @a == @$root; |
51 | ok 5, &dump($root) eq $dumped; |
52 | |
53 | unlink 't/store'; |
54 | |