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