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 | # |
25f64a11 |
5 | # Copyright (c) 1995-2000, Raphael Manfredi |
6 | # |
7 | # You may redistribute only under the same terms as Perl 5, as specified |
8 | # in the README file that comes with the distribution. |
dd19458b |
9 | # |
10 | |
11 | sub BEGIN { |
0c384302 |
12 | if ($ENV{PERL_CORE}){ |
13 | chdir('t') if -d 't'; |
7dadce44 |
14 | @INC = ('.', '../lib', '../ext/Storable/t'); |
372cb964 |
15 | } else { |
16 | unshift @INC, 't'; |
0c384302 |
17 | } |
dd19458b |
18 | require Config; import Config; |
0c384302 |
19 | if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) { |
dd19458b |
20 | print "1..0 # Skip: Storable was not built\n"; |
21 | exit 0; |
22 | } |
862382c7 |
23 | |
372cb964 |
24 | require 'st-dump.pl'; |
dd19458b |
25 | } |
26 | |
27 | sub ok; |
28 | |
c8c31c49 |
29 | use Storable qw(lock_store lock_retrieve); |
30 | |
31 | unless (&Storable::CAN_FLOCK) { |
32 | print "1..0 # Skip: fcntl/flock emulation broken on this platform\n"; |
33 | exit 0; |
34 | } |
35 | |
dd19458b |
36 | print "1..5\n"; |
37 | |
38 | @a = ('first', undef, 3, -4, -3.14159, 456, 4.5); |
39 | |
40 | # |
41 | # We're just ensuring things work, we're not validating locking. |
42 | # |
43 | |
44 | ok 1, defined lock_store(\@a, 'store'); |
45 | ok 2, $dumped = &dump(\@a); |
46 | |
47 | $root = lock_retrieve('store'); |
48 | ok 3, ref $root eq 'ARRAY'; |
49 | ok 4, @a == @$root; |
50 | ok 5, &dump($root) eq $dumped; |
51 | |
52 | unlink 't/store'; |
53 | |