Re: [Another bug] Re: about Storable perl module (again)
[p5sagit/p5-mst-13.2.git] / ext / Storable / t / lock.t
CommitLineData
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
22sub BEGIN {
0c384302 23 if ($ENV{PERL_CORE}){
24 chdir('t') if -d 't';
7dadce44 25 @INC = ('.', '../lib', '../ext/Storable/t');
372cb964 26 } else {
27 unshift @INC, 't';
0c384302 28 }
dd19458b 29 require Config; import Config;
0c384302 30 if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bStorable\b/) {
dd19458b 31 print "1..0 # Skip: Storable was not built\n";
32 exit 0;
33 }
862382c7 34
372cb964 35 require 'st-dump.pl';
dd19458b 36}
37
38sub ok;
39
c8c31c49 40use Storable qw(lock_store lock_retrieve);
41
42unless (&Storable::CAN_FLOCK) {
43 print "1..0 # Skip: fcntl/flock emulation broken on this platform\n";
44 exit 0;
45}
46
dd19458b 47print "1..5\n";
48
49@a = ('first', undef, 3, -4, -3.14159, 456, 4.5);
50
51#
52# We're just ensuring things work, we're not validating locking.
53#
54
55ok 1, defined lock_store(\@a, 'store');
56ok 2, $dumped = &dump(\@a);
57
58$root = lock_retrieve('store');
59ok 3, ref $root eq 'ARRAY';
60ok 4, @a == @$root;
61ok 5, &dump($root) eq $dumped;
62
63unlink 't/store';
64