Project

General

Profile

Feature #6737 ยป hash.patch

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

View differences:

hash.c
3396 3396

  
3397 3397
    rb_define_method(rb_cHash,"==", rb_hash_equal, 1);
3398 3398
    rb_define_method(rb_cHash,"[]", rb_hash_aref, 1);
3399
    rb_define_method(rb_cHash,"retrieve", rb_hash_aref, 1);
3399 3400
    rb_define_method(rb_cHash,"hash", rb_hash_hash, 0);
3400 3401
    rb_define_method(rb_cHash,"eql?", rb_hash_eql, 1);
3401 3402
    rb_define_method(rb_cHash,"fetch", rb_hash_fetch_m, -1);
test/ruby/test_hash.rb
8 8
    y = {1=>2, 2=>4, 3=>6} # y = {1, 2, 2, 4, 3, 6} # 1.9 doesn't support
9 9

  
10 10
    assert_equal(2, x[1])
11
    assert_equal(2, x.retrieve(1))
11 12

  
12 13
    assert(begin
13 14
         for k,v in y