Test tweak to avoid pulling in the whole Config.
[p5sagit/p5-mst-13.2.git] / t / lib / st-lock.t
1 #!./perl
2
3 # $Id: lock.t,v 1.0.1.2 2000/10/23 18:03:07 ram Exp ram $
4 #
5 #  @COPYRIGHT@
6 #
7 # $Log: lock.t,v $
8 # Revision 1.0.1.2  2000/10/23 18:03:07  ram
9 # patch4: protected calls to flock() for dos platform
10 #
11 # Revision 1.0.1.1  2000/09/28 21:44:06  ram
12 # patch2: created.
13 #
14 #
15
16 sub BEGIN {
17     chdir('t') if -d 't';
18     @INC = '.'; 
19     push @INC, '../lib';
20     require Config; import Config;
21     if ($Config{'extensions'} !~ /\bStorable\b/) {
22         print "1..0 # Skip: Storable was not built\n";
23         exit 0;
24     }
25     if (!$Config{'d_flock'} && !$Config{'d_fcntl'} && !$Config{'d_lockf'}) {
26         print "1..0 # Skip: no flock or flock emulation on this platform\n";
27         exit 0;
28     }
29     if ($^O eq 'dos') {
30         print "1..0 # Skip: fcntl/flock emulation broken on this platform\n";
31         exit 0;
32     }
33     require 'lib/st-dump.pl';
34 }
35
36 sub ok;
37
38 use Storable qw(lock_store lock_retrieve);
39
40 print "1..5\n";
41
42 @a = ('first', undef, 3, -4, -3.14159, 456, 4.5);
43
44 #
45 # We're just ensuring things work, we're not validating locking.
46 #
47
48 ok 1, defined lock_store(\@a, 'store');
49 ok 2, $dumped = &dump(\@a);
50
51 $root = lock_retrieve('store');
52 ok 3, ref $root eq 'ARRAY';
53 ok 4, @a == @$root;
54 ok 5, &dump($root) eq $dumped; 
55
56 unlink 't/store';
57