forked from jruby/jruby
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
complimentary patch to fix regression rehashing hashing fix (this and…
… previous patch prepared by nahi)
- Loading branch information
Showing
2 changed files
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
describe "JRUBY-6209: Hash#rehash does not work under some condition" do | ||
it "works even it contains a key where #hash is negative" do | ||
a = "ASCII" | ||
b = "\xE3\x81\x82" # Japanese 'a' in UTF-8, but encoding is not related | ||
# b.hash < 0 at this moment, but there's no reason to be negative in the future. | ||
# b.hash.should < 0 | ||
key = [a] | ||
hash = Hash[key => 100] | ||
key[0] = b | ||
hash.rehash | ||
hash[key].should == 100 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters