From: Jarkko Hietaniemi Date: Thu, 2 May 2002 03:41:39 +0000 (+0000) Subject: Add the new Digest::MD5 test. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e60967a13dae9e5cc59bd4c47458385684a14c3;p=p5sagit%2Fp5-mst-13.2.git Add the new Digest::MD5 test. p4raw-id: //depot/perl@16326 --- diff --git a/MANIFEST b/MANIFEST index e39a324..86d0148 100644 --- a/MANIFEST +++ b/MANIFEST @@ -174,6 +174,7 @@ ext/Digest/MD5/t/align.t See if Digest::MD5 extension works ext/Digest/MD5/t/badfile.t See if Digest::MD5 extension works ext/Digest/MD5/t/files.t See if Digest::MD5 extension works ext/Digest/MD5/t/md5-aaa.t See if Digest::MD5 extension works +ext/Digest/MD5/t/utf8.t See if Digest::MD5 extension works ext/Digest/MD5/typemap Digest::MD5 extension ext/DynaLoader/dlutils.c Dynamic loader utilities for dl_*.xs files ext/DynaLoader/dl_aix.xs AIX implementation diff --git a/ext/Digest/MD5/t/utf8.t b/ext/Digest/MD5/t/utf8.t new file mode 100644 index 0000000..65d929b --- /dev/null +++ b/ext/Digest/MD5/t/utf8.t @@ -0,0 +1,29 @@ +#!perl -w + +if ($] < 5.006) { + print "1..0\n"; + exit; +} + +print "1..3\n"; + +use strict; +use Digest::MD5 qw(md5_hex); + +my $str; +$str = "foo\xFF\x{100}"; + +eval { + print md5_hex($str); + print "not ok 1\n"; # should not run +}; +print "not " unless $@ && $@ =~ /^(Big byte|Wide character)/; +print "ok 1\n"; + +chop($str); # only bytes left +print "not " unless md5_hex($str) eq "503debffe559537231ed24f25651ec20"; +print "ok 2\n"; + +# reference +print "not " unless md5_hex("foo\xFF") eq "503debffe559537231ed24f25651ec20"; +print "ok 3\n";