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