to-hash-kwarg.patch

Stephen Celis, 06/10/2013 03:27 AM

Download (939 Bytes)

View differences:

vm.c (working copy)
2181 2181
static VALUE
2182 2182
m_core_hash_merge_kwd(VALUE recv, VALUE hash, VALUE kw)
2183 2183
{
2184
    kw = rb_convert_type(kw, T_HASH, "Hash", "to_hash");
2184
    kw = rb_Hash(kw);
2185 2185
    rb_hash_foreach(kw, kwmerge_i, hash);
2186 2186
    return hash;
2187 2187
}
test/ruby/test_keyword.rb (working copy)
8 8

  
9 9
  def test_f1
10 10
    assert_equal(["foo", 424242], f1)
11
    assert_equal(["foo", 424242], f1(**nil))
12
    assert_equal(["foo", 424242], f1(**[]))
13
    assert_equal(["foo", 424242], f1(**{}))
11 14
    assert_equal(["bar", 424242], f1(str: "bar"))
12 15
    assert_equal(["foo", 111111], f1(num: 111111))
13 16
    assert_equal(["bar", 111111], f1(str: "bar", num: 111111))