Lots of spring cleaning. (No functional changes.)
[p5sagit/p5-mst-13.2.git] / ext / Storable / t / lock.t
1 #!./perl
2
3 # $Id: lock.t,v 1.0.1.4 2001/01/03 09:41:00 ram Exp $
4 #
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.
9 #
10
11 sub BEGIN {
12     if ($ENV{PERL_CORE}){
13         chdir('t') if -d 't';
14         @INC = ('.', '../lib', '../ext/Storable/t');
15     } else {
16         unshift @INC, 't';
17     }
18     require Config; import Config;
19     if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
20         print "1..0 # Skip: Storable was not built\n";
21         exit 0;
22     }
23
24     require 'st-dump.pl';
25 }
26
27 sub ok;
28
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
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