1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_object.rb (test_remove_method): test for Bug#2202.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-10-16 00:53:18 +00:00
parent be8bebb151
commit e0eb17f887

View file

@ -265,6 +265,26 @@ class TestObject < Test::Unit::TestCase
c.instance_eval { remove_method(:foo) }
end
c = Class.new do
def meth1; "meth" end
end
d = Class.new(c) do
alias meth2 meth1
end
o1 = c.new
assert_respond_to(o1, :meth1)
assert_equal("meth", o1.meth1)
o2 = d.new
assert_respond_to(o2, :meth1)
assert_equal("meth", o2.meth1)
assert_respond_to(o2, :meth2)
assert_equal("meth", o2.meth2)
d.class_eval do
remove_method :meth2
end
bug2202 = '[ruby-core:26074]'
assert_raise(NoMethodError, bug2202) {o2.meth2}
%w(object_id __send__ initialize).each do |m|
assert_in_out_err([], <<-INPUT, %w(:ok), /warning: removing `#{m}' may cause serious problems$/)
$VERBOSE = false