Now that binmode(FH) does implicit ":bytes" revisit
[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..2\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/;
15 print "ok 1\n";
16
17 open(BAR, "none-existing-file.$$");
18 $md5->addfile(*BAR);
19
20 print "not " unless $md5->hexdigest eq "d41d8cd98f00b204e9800998ecf8427e";
21 print "ok 2\n";