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