[svn:parrot] r39282 - in trunk: src t/op

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Sun May 31 03:59:22 UTC 2009


Author: pmichaud
Date: Sun May 31 03:59:21 2009
New Revision: 39282
URL: https://trac.parrot.org/parrot/changeset/39282

Log:
[core]:  Fix TT #24, equivalence of hash keys.
* Add a new test for TT #24, the existing test looks wrong to me.

Modified:
   trunk/src/hash.c
   trunk/t/op/stringu.t

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	Sat May 30 17:10:39 2009	(r39281)
+++ trunk/src/hash.c	Sun May 31 03:59:21 2009	(r39282)
@@ -202,7 +202,7 @@
     if (!s2)
         return 1;
 
-    if (s1->hashval != s2->hashval)
+    if (s1->charset == s2->charset && s1->hashval != s2->hashval)
         return 1;
 
     /* COWed strings */

Modified: trunk/t/op/stringu.t
==============================================================================
--- trunk/t/op/stringu.t	Sat May 30 17:10:39 2009	(r39281)
+++ trunk/t/op/stringu.t	Sun May 31 03:59:21 2009	(r39282)
@@ -6,7 +6,7 @@
 use warnings;
 use lib qw( . lib ../lib ../../lib );
 use Test::More;
-use Parrot::Test tests => 27;
+use Parrot::Test tests => 28;
 use Parrot::Config;
 
 =head1 NAME
@@ -452,6 +452,30 @@
 \xc2\xab
 OUTPUT
 
+pir_output_is( <<'CODE', <<OUTPUT, "UTF-8 and Unicode hash keys");
+.sub 'main'
+    .local string str0, str1
+    str0 = unicode:"\u00ab"
+    str1 = iso-8859-1:"\xab"
+
+    .local pmc hash
+    hash = new 'Hash'
+    hash[str0] = 'hello'
+
+    $I0 = iseq str0, str1
+    say $I0
+
+    $S0 = hash[str0]
+    $S1 = hash[str1]
+    $I0 = iseq $S0, $S1
+    say $I0
+.end
+CODE
+1
+1
+OUTPUT
+
+
 # Local Variables:
 #   mode: cperl
 #   cperl-indent-level: 4


More information about the parrot-commits mailing list