Project

General

Profile

Feature #6737 ยป hash.patch

trans (Thomas Sawyer), 11/06/2012 06:42 AM

View differences:

hash.c
rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
rb_define_method(rb_cHash,"retrieve", rb_hash_aref, 1);
rb_define_method(rb_cHash,"hash", rb_hash_hash, 0);
rb_define_method(rb_cHash,"eql?", rb_hash_eql, 1);
rb_define_method(rb_cHash,"fetch", rb_hash_fetch_m, -1);
test/ruby/test_hash.rb
y = {1=>2, 2=>4, 3=>6} # y = {1, 2, 2, 4, 3, 6} # 1.9 doesn't support
assert_equal(2, x[1])
assert_equal(2, x.retrieve(1))
assert(begin
for k,v in y
    (1-1/1)