1#!./perl
2#
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.
7#
8
9sub BEGIN {
10    unshift @INC, 't';
11    unshift @INC, 't/compat' if $] < 5.006002;
12    require Config; import Config;
13    if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
14        print "1..0 # Skip: Storable was not built\n";
15        exit 0;
16    }
17
18    require 'st-dump.pl';
19}
20
21use Test::More;
22use Storable qw(lock_store lock_retrieve);
23
24unless (&Storable::CAN_FLOCK) {
25    plan(skip_all => "fcntl/flock emulation broken on this platform");
26}
27
28plan(tests => 5);
29
30@a = ('first', undef, 3, -4, -3.14159, 456, 4.5);
31
32#
33# We're just ensuring things work, we're not validating locking.
34#
35
36isnt(lock_store(\@a, "store$$"), undef);
37my $dumped = &dump(\@a);
38isnt($dumped, undef);
39
40$root = lock_retrieve("store$$");
41is(ref $root, 'ARRAY');
42is(scalar @a, scalar @$root);
43is(&dump($root), $dumped);
44
45END { 1 while unlink "store$$" }
46
47