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