xref: /openbsd-src/gnu/usr.bin/perl/cpan/Digest-MD5/t/badfile.t (revision 256a93a44f36679bee503f12e49566c2183f6181)
1*256a93a4Safresh1use strict;
2*256a93a4Safresh1use warnings;
3b39c5158Smillert
4b39c5158Smillertuse Digest::MD5 ();
5b39c5158Smillert
6*256a93a4Safresh1print "1..2\n";
7*256a93a4Safresh1my $md5 = Digest::MD5->new;
8b39c5158Smillert
9b39c5158Smillerteval {
10b39c5158Smillert   use vars qw(*FOO);
11b39c5158Smillert   $md5->addfile(*FOO);
12b39c5158Smillert};
13b39c5158Smillertprint "not " unless $@ =~ /^Bad filehandle: FOO at/;
14b39c5158Smillertprint "ok 1\n";
15b39c5158Smillert
16b39c5158Smillertopen(BAR, "no-existing-file.$$");
17b39c5158Smillerteval {
18b39c5158Smillert    $md5->addfile(*BAR);
19b39c5158Smillert};
20b39c5158Smillertprint "not " unless $@ =~ /^No filehandle passed at/;
21b39c5158Smillertprint "ok 2\n";
22