Commit | Line | Data |
dd19458b |
1 | #!./perl |
2 | |
862382c7 |
3 | # $Id: lock.t,v 1.0.1.4 2001/01/03 09:41:00 ram Exp $ |
dd19458b |
4 | # |
5 | # @COPYRIGHT@ |
6 | # |
7 | # $Log: lock.t,v $ |
862382c7 |
8 | # Revision 1.0.1.4 2001/01/03 09:41:00 ram |
9 | # patch7: use new CAN_FLOCK routine to determine whether to run tests |
10 | # |
212e9bde |
11 | # Revision 1.0.1.3 2000/10/26 17:11:27 ram |
12 | # patch5: just check $^O, there's no need for the whole Config |
13 | # |
b29b780f |
14 | # Revision 1.0.1.2 2000/10/23 18:03:07 ram |
15 | # patch4: protected calls to flock() for dos platform |
16 | # |
dd19458b |
17 | # Revision 1.0.1.1 2000/09/28 21:44:06 ram |
18 | # patch2: created. |
19 | # |
20 | # |
21 | |
22 | sub BEGIN { |
23 | chdir('t') if -d 't'; |
b29b780f |
24 | @INC = '.'; |
dd19458b |
25 | push @INC, '../lib'; |
26 | require Config; import Config; |
27 | if ($Config{'extensions'} !~ /\bStorable\b/) { |
28 | print "1..0 # Skip: Storable was not built\n"; |
29 | exit 0; |
30 | } |
c9ff6e92 |
31 | if ($^O eq 'mpeix') { |
32 | print "1..0 # Skip: truncate missing on MPE\n"; |
33 | exit 0; |
34 | } |
862382c7 |
35 | |
dd19458b |
36 | require 'lib/st-dump.pl'; |
37 | } |
38 | |
39 | sub ok; |
40 | |
c8c31c49 |
41 | use Storable qw(lock_store lock_retrieve); |
42 | |
43 | unless (&Storable::CAN_FLOCK) { |
44 | print "1..0 # Skip: fcntl/flock emulation broken on this platform\n"; |
45 | exit 0; |
46 | } |
47 | |
dd19458b |
48 | print "1..5\n"; |
49 | |
50 | @a = ('first', undef, 3, -4, -3.14159, 456, 4.5); |
51 | |
52 | # |
53 | # We're just ensuring things work, we're not validating locking. |
54 | # |
55 | |
56 | ok 1, defined lock_store(\@a, 'store'); |
57 | ok 2, $dumped = &dump(\@a); |
58 | |
59 | $root = lock_retrieve('store'); |
60 | ok 3, ref $root eq 'ARRAY'; |
61 | ok 4, @a == @$root; |
62 | ok 5, &dump($root) eq $dumped; |
63 | |
64 | unlink 't/store'; |
65 | |