Integrate Digest-1.00 and Digest-MD5-2.13, from Gisle Aas.
[p5sagit/p5-mst-13.2.git] / t / lib / md5-badf.t
1 BEGIN {
2         chdir 't' if -d 't';
3         @INC = '../lib';
4 }
5
6 # Digest::MD5 2.07 and older used to trigger a core dump when
7 # passed an illegal file handle that failed to open.
8
9 print "1..2\n";
10
11 use Digest::MD5 ();
12
13 $md5 = Digest::MD5->new;
14
15 eval {
16    use vars qw(*FOO);
17    $md5->addfile(*FOO);
18 };
19 print "not " unless $@ =~ /^Bad filehandle: FOO/;
20 print "ok 1\n";
21
22 open(BAR, "none-existing-file.$$");
23 $md5->addfile(*BAR);
24
25 print "not " unless $md5->hexdigest eq "d41d8cd98f00b204e9800998ecf8427e";
26 print "ok 2\n";