Project

General

Profile

Bug #8507 ยป to-hash-kwarg.patch

stephencelis (Stephen Celis), 06/10/2013 03:27 AM

View differences:

vm.c (working copy)
static VALUE
m_core_hash_merge_kwd(VALUE recv, VALUE hash, VALUE kw)
{
kw = rb_convert_type(kw, T_HASH, "Hash", "to_hash");
kw = rb_Hash(kw);
rb_hash_foreach(kw, kwmerge_i, hash);
return hash;
}
test/ruby/test_keyword.rb (working copy)
def test_f1
assert_equal(["foo", 424242], f1)
assert_equal(["foo", 424242], f1(**nil))
assert_equal(["foo", 424242], f1(**[]))
assert_equal(["foo", 424242], f1(**{}))
assert_equal(["bar", 424242], f1(str: "bar"))
assert_equal(["foo", 111111], f1(num: 111111))
assert_equal(["bar", 111111], f1(str: "bar", num: 111111))
    (1-1/1)