Mention known sfio+linux buglet.
[p5sagit/p5-mst-13.2.git] / t / lib / st-forgive.t
CommitLineData
7a6a85bf 1#!./perl
2
3# $Id: forgive.t,v 0.7.1.1 2000/08/03 22:04:45 ram Exp $
4#
5# Copyright (c) 1995-2000, Raphael Manfredi
6#
7# You may redistribute only under the terms of the Artistic License,
8# as specified in the README file that comes with the distribution.
9#
10# Original Author: Ulrich Pfeifer
11# (C) Copyright 1997, Universitat Dortmund, all rights reserved.
12#
13# $Log: forgive.t,v $
14# Revision 0.7.1.1 2000/08/03 22:04:45 ram
15# Baseline for second beta release.
16#
17# Revision 0.7 2000/08/03 22:04:45 ram
18# Baseline for second beta release.
19#
20
21sub BEGIN {
22 chdir('t') if -d 't';
20822f61 23 @INC = '.';
24 push @INC, '../lib';
9f233367 25 require Config; import Config;
26 if ($Config{'extensions'} !~ /\bStorable\b/) {
27 print "1..0 # Skip: Storable was not built\n";
28 exit 0;
29 }
7a6a85bf 30}
31
32use Storable qw(store retrieve);
29fc1735 33use File::Spec;
7a6a85bf 34
35print "1..8\n";
36
37my $test = 1;
38my $bad = ['foo', sub { 1 }, 'bar'];
39my $result;
40
41eval {$result = store ($bad , 'store')};
42print ((!defined $result)?"ok $test\n":"not ok $test\n"); $test++;
43print (($@ ne '')?"ok $test\n":"not ok $test\n"); $test++;
44
45$Storable::forgive_me=1;
46
29fc1735 47my $devnull = File::Spec->devnull;
48
7a6a85bf 49open(SAVEERR, ">&STDERR");
f42118b2 50open(STDERR, ">$devnull") or
7a6a85bf 51 ( print SAVEERR "Unable to redirect STDERR: $!\n" and exit(1) );
52
53eval {$result = store ($bad , 'store')};
54
55open(STDERR, ">&SAVEERR");
56
57print ((defined $result)?"ok $test\n":"not ok $test\n"); $test++;
58print (($@ eq '')?"ok $test\n":"not ok $test\n"); $test++;
59
60my $ret = retrieve('store');
61print ((defined $ret)?"ok $test\n":"not ok $test\n"); $test++;
62print (($ret->[0] eq 'foo')?"ok $test\n":"not ok $test\n"); $test++;
63print (($ret->[2] eq 'bar')?"ok $test\n":"not ok $test\n"); $test++;
64print ((ref $ret->[1] eq 'SCALAR')?"ok $test\n":"not ok $test\n"); $test++;
65
66
29fc1735 67END { 1 while unlink 'store' }