parent
a505cd32fb
commit
f1dda5ed01
Notes:
git
2024-11-30 04:41:19 +00:00
@ -8,6 +8,7 @@ firstline, predefined = __LINE__+1, %[\
|
|||||||
inspect
|
inspect
|
||||||
intern
|
intern
|
||||||
object_id
|
object_id
|
||||||
|
__id__
|
||||||
const_added
|
const_added
|
||||||
const_missing
|
const_missing
|
||||||
method_missing MethodMissing
|
method_missing MethodMissing
|
||||||
|
@ -11,8 +11,10 @@ describe "BasicObject#equal?" do
|
|||||||
it "is unaffected by overriding __id__" do
|
it "is unaffected by overriding __id__" do
|
||||||
o1 = mock("object")
|
o1 = mock("object")
|
||||||
o2 = mock("object")
|
o2 = mock("object")
|
||||||
def o1.__id__; 10; end
|
suppress_warning {
|
||||||
def o2.__id__; 10; end
|
def o1.__id__; 10; end
|
||||||
|
def o2.__id__; 10; end
|
||||||
|
}
|
||||||
o1.equal?(o2).should be_false
|
o1.equal?(o2).should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1488,7 +1488,7 @@ class TestModule < Test::Unit::TestCase
|
|||||||
class << o; self; end.instance_eval { undef_method(:foo) }
|
class << o; self; end.instance_eval { undef_method(:foo) }
|
||||||
end
|
end
|
||||||
|
|
||||||
%w(object_id __send__ initialize).each do |n|
|
%w(object_id __id__ __send__ initialize).each do |n|
|
||||||
assert_in_out_err([], <<-INPUT, [], %r"warning: undefining '#{n}' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, [], %r"warning: undefining '#{n}' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
Class.new.instance_eval { undef_method(:#{n}) }
|
Class.new.instance_eval { undef_method(:#{n}) }
|
||||||
|
@ -480,7 +480,7 @@ class TestObject < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_redefine_method_which_may_case_serious_problem
|
def test_redefine_method_which_may_case_serious_problem
|
||||||
%w(object_id __send__).each do |m|
|
%w(object_id __id__ __send__).each do |m|
|
||||||
assert_in_out_err([], <<-INPUT, [], %r"warning: redefining '#{m}' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, [], %r"warning: redefining '#{m}' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
def (Object.new).#{m}; end
|
def (Object.new).#{m}; end
|
||||||
@ -542,7 +542,7 @@ class TestObject < Test::Unit::TestCase
|
|||||||
bug2202 = '[ruby-core:26074]'
|
bug2202 = '[ruby-core:26074]'
|
||||||
assert_raise(NoMethodError, bug2202) {o2.meth2}
|
assert_raise(NoMethodError, bug2202) {o2.meth2}
|
||||||
|
|
||||||
%w(object_id __send__ initialize).each do |m|
|
%w(object_id __id__ __send__ initialize).each do |m|
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing '#{m}' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing '#{m}' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
begin
|
begin
|
||||||
|
@ -1072,7 +1072,7 @@ rb_method_entry_make(VALUE klass, ID mid, VALUE defined_class, rb_method_visibil
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* check mid */
|
/* check mid */
|
||||||
if (mid == object_id || mid == id__send__) {
|
if (mid == object_id || mid == id__id__ || mid == id__send__) {
|
||||||
if (type != VM_METHOD_TYPE_CFUNC && search_method(klass, mid, 0)) {
|
if (type != VM_METHOD_TYPE_CFUNC && search_method(klass, mid, 0)) {
|
||||||
rb_warn("redefining '%s' may cause serious problems", rb_id2name(mid));
|
rb_warn("redefining '%s' may cause serious problems", rb_id2name(mid));
|
||||||
}
|
}
|
||||||
@ -1681,7 +1681,7 @@ remove_method(VALUE klass, ID mid)
|
|||||||
|
|
||||||
rb_class_modify_check(klass);
|
rb_class_modify_check(klass);
|
||||||
klass = RCLASS_ORIGIN(klass);
|
klass = RCLASS_ORIGIN(klass);
|
||||||
if (mid == object_id || mid == id__send__ || mid == idInitialize) {
|
if (mid == object_id || mid == id__id__ || mid == id__send__ || mid == idInitialize) {
|
||||||
rb_warn("removing '%s' may cause serious problems", rb_id2name(mid));
|
rb_warn("removing '%s' may cause serious problems", rb_id2name(mid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1911,7 +1911,7 @@ rb_undef(VALUE klass, ID id)
|
|||||||
rb_raise(rb_eTypeError, "no class to undef method");
|
rb_raise(rb_eTypeError, "no class to undef method");
|
||||||
}
|
}
|
||||||
rb_class_modify_check(klass);
|
rb_class_modify_check(klass);
|
||||||
if (id == object_id || id == id__send__ || id == idInitialize) {
|
if (id == object_id || id == id__id__ || id == id__send__ || id == idInitialize) {
|
||||||
rb_warn("undefining '%s' may cause serious problems", rb_id2name(id));
|
rb_warn("undefining '%s' may cause serious problems", rb_id2name(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user