mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_module.rb (test_remove_class_variable): add a test
for Class#remove_class_variable. * test/ruby/test_object.rb (test_remove_instance_variable): add a test for Object#remove_instance_variable. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae4bc66b64
commit
270f2f15be
3 changed files with 24 additions and 10 deletions
|
@ -170,6 +170,13 @@ class TestObject < Test::Unit::TestCase
|
|||
assert_raise(NameError) { o.instance_variable_defined?(:foo) }
|
||||
end
|
||||
|
||||
def test_remove_instance_variable
|
||||
o = Object.new
|
||||
o.instance_eval { @foo = :foo }
|
||||
o.instance_eval { remove_instance_variable(:@foo) }
|
||||
assert_equal(false, o.instance_variable_defined?(:@foo))
|
||||
end
|
||||
|
||||
def test_convert_type
|
||||
o = Object.new
|
||||
def o.to_s; 1; end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue