Project

General

Profile

Feature #5072 » 0002-Fix-handling-of-respond_to_missing-after-r32621.patch

jeremyevans0 (Jeremy Evans), 07/23/2011 02:36 PM

View differences:

test/ruby/test_object.rb
assert_nothing_raised(bug2494) {[b].flatten}
end
def test_respond_to_missing_string
c = Class.new do
def respond_to_missing?(id, priv)
!(id !~ /\Agadzoks\d+\z/) ^ priv
end
end
foo = c.new
assert_equal(false, foo.respond_to?("gadzooks16"))
assert_equal(true, foo.respond_to?("gadzooks17", true))
assert_equal(true, foo.respond_to?("gadzoks16"))
assert_equal(false, foo.respond_to?("gadzoks17", true))
end
def test_respond_to_missing
c = Class.new do
def respond_to_missing?(id, priv)
vm_method.c
rb_scan_args(argc, argv, "11", &mid, &priv);
if (!(id = rb_check_id(mid)))
return Qfalse;
if (rb_method_basic_definition_p(CLASS_OF(obj), respond_to_missing)) {
return Qfalse;
} else {
return rb_funcall(obj, respond_to_missing, 2, ID2SYM(rb_to_id(mid)), RTEST(priv) ? Qtrue : Qfalse);
}
if (basic_obj_respond_to(obj, id, !RTEST(priv)))
return Qtrue;
return Qfalse;
(3-3/3)