Change 27335 by [EMAIL PROTECTED] on 2006/02/27 11:26:58
Subject: Testing hash key stringification
From: Anno Siegel <[EMAIL PROTECTED]>
Date: Sun, 26 Feb 2006 23:30:01 +0100
Message-Id: <[EMAIL PROTECTED]>
Affected files ...
... //depot/perl/t/op/hashassign.t#3 edit
Differences ...
==== //depot/perl/t/op/hashassign.t#3 (text) ====
Index: perl/t/op/hashassign.t
--- perl/t/op/hashassign.t#2~21714~ 2003-11-13 10:55:37.000000000 -0800
+++ perl/t/op/hashassign.t 2006-02-27 03:26:58.000000000 -0800
@@ -8,7 +8,7 @@
# use strict;
-plan tests => 213;
+plan tests => 215;
my @comma = ("key", "value");
@@ -289,3 +289,20 @@
is( $#$ar, 2, 'scalar + hash assignment in list context' );
is( "@$ar", "0 1 5", '...gets the last values' );
}
+
+# test stringification of keys
+{
+ no warnings 'once';
+ my @types = qw( SCALAR ARRAY HASH CODE GLOB);
+ my @refs = ( \ do { my $x }, [], {}, sub {}, \ *x);
+ my(%h, %expect);
+ @[EMAIL PROTECTED] = @types;
+ @expect{map "$_", @refs} = @types;
+ ok (eq_hash(\%h, \%expect), 'unblessed ref stringification');
+
+ bless $_ for @refs;
+ %h = (); %expect = ();
+ @[EMAIL PROTECTED] = @types;
+ @expect{map "$_", @refs} = @types;
+ ok (eq_hash(\%h, \%expect), 'blessed ref stringification');
+}
End of Patch.