Retract #20056, #20055, #20052, #20050, #20048: the changes
[p5sagit/p5-mst-13.2.git] / ext / Digest / MD5 / t / badfile.t
1 # Digest::MD5 2.07 and older used to trigger a core dump when
2 # passed an illegal file handle that failed to open.
3
4 print "1..3\n";
5
6 use Digest::MD5 ();
7
8 $md5 = Digest::MD5->new;
9
10 eval {
11    use vars qw(*FOO);
12    $md5->addfile(*FOO);
13 };
14 print "not " unless $@ =~ /^Bad filehandle: FOO at/;
15 print "ok 1\n";
16
17 open(BAR, "no-existing-file.$$");
18 eval {
19     $md5->addfile(*BAR);
20 };
21 print "not " unless $@ =~ /^No filehandle passed at/;
22 print "ok 2\n";
23
24 open(BAR, ">no-existing-file.$$") || die;
25 eval {
26     $md5->addfile(*BAR);
27 };
28 print "not " unless $@ =~ /^Reading from filehandle failed at/;
29 print "ok 3\n";
30
31 close(BAR);
32 unlink("no-existing-file.$$");