Commit | Line | Data |
2e60967a |
1 | #!perl -w |
2 | |
3 | if ($] < 5.006) { |
4 | print "1..0\n"; |
5 | exit; |
6 | } |
7 | |
8 | print "1..3\n"; |
9 | |
10 | use strict; |
11 | use Digest::MD5 qw(md5_hex); |
12 | |
13 | my $str; |
14 | $str = "foo\xFF\x{100}"; |
15 | |
16 | eval { |
17 | print md5_hex($str); |
18 | print "not ok 1\n"; # should not run |
19 | }; |
20 | print "not " unless $@ && $@ =~ /^(Big byte|Wide character)/; |
21 | print "ok 1\n"; |
22 | |
23 | chop($str); # only bytes left |
24 | print "not " unless md5_hex($str) eq "503debffe559537231ed24f25651ec20"; |
25 | print "ok 2\n"; |
26 | |
27 | # reference |
28 | print "not " unless md5_hex("foo\xFF") eq "503debffe559537231ed24f25651ec20"; |
29 | print "ok 3\n"; |