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
334 334
    assert_nothing_raised(bug2494) {[b].flatten}
335 335
  end
336 336

  
337
  def test_respond_to_missing_string
338
    c = Class.new do
339
      def respond_to_missing?(id, priv)
340
        !(id !~ /\Agadzoks\d+\z/) ^ priv
341
      end
342
    end
343
    foo = c.new
344
    assert_equal(false, foo.respond_to?("gadzooks16"))
345
    assert_equal(true, foo.respond_to?("gadzooks17", true))
346
    assert_equal(true, foo.respond_to?("gadzoks16"))
347
    assert_equal(false, foo.respond_to?("gadzoks17", true))
348
  end
349

  
337 350
  def test_respond_to_missing
338 351
    c = Class.new do
339 352
      def respond_to_missing?(id, priv)
vm_method.c
1246 1246

  
1247 1247
    rb_scan_args(argc, argv, "11", &mid, &priv);
1248 1248
    if (!(id = rb_check_id(mid)))
1249
	return Qfalse;
1249
	if (rb_method_basic_definition_p(CLASS_OF(obj), respond_to_missing)) {
1250
	    return Qfalse;
1251
	} else {
1252
	    return rb_funcall(obj, respond_to_missing, 2, ID2SYM(rb_to_id(mid)), RTEST(priv) ? Qtrue : Qfalse);
1253
	}
1250 1254
    if (basic_obj_respond_to(obj, id, !RTEST(priv)))
1251 1255
	return Qtrue;
1252 1256
    return Qfalse;
1253
-