summaryrefslogtreecommitdiffstats
path: root/test/ruby/test_module.rb
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-09 13:16:07 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-10-09 13:16:07 +0000
commit90dcdaee15f51f96b72a5b614e5e44f7501e2899 (patch)
treee4715ce5c7d5acba079341a5cfd4d8838479cf87 /test/ruby/test_module.rb
parentbf9c4580847ea9a1ba32723062c6610752a90263 (diff)
downloadruby-90dcdaee15f51f96b72a5b614e5e44f7501e2899.tar.gz
ruby-90dcdaee15f51f96b72a5b614e5e44f7501e2899.tar.xz
ruby-90dcdaee15f51f96b72a5b614e5e44f7501e2899.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@19728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_module.rb')
-rw-r--r--test/ruby/test_module.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 072f559c3..e1f729963 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -210,14 +210,6 @@ class TestModule < Test::Unit::TestCase
assert(Other.constants.include?(:CLASS_EVAL))
end
- def test_class_variable_set
- # TODO
- end
-
- def test_class_variable_get
- # TODO
- end
-
def test_const_defined?
assert(Math.const_defined?(:PI))
assert(Math.const_defined?("PI"))
@@ -445,7 +437,7 @@ class TestModule < Test::Unit::TestCase
assert_raise(NameError) { c1.const_defined?(:foo) }
end
- def test_class_variable_get2
+ def test_class_variable_get
c = Class.new
c.class_eval { @@foo = :foo }
assert_equal(:foo, c.class_variable_get(:@@foo))
@@ -453,7 +445,7 @@ class TestModule < Test::Unit::TestCase
assert_raise(NameError) { c.class_variable_get(:foo) }
end
- def test_class_variable_set2
+ def test_class_variable_set
c = Class.new
c.class_variable_set(:@@foo, :foo)
assert_equal(:foo, c.class_eval { @@foo })
@@ -468,6 +460,13 @@ class TestModule < Test::Unit::TestCase
assert_raise(NameError) { c.class_variable_defined?(:foo) }
end
+ def test_remove_class_variable
+ c = Class.new
+ c.class_eval { @@foo = :foo }
+ c.class_eval { remove_class_variable(:@@foo) }
+ assert_equal(false, c.class_variable_defined?(:@@foo))
+ end
+
def test_export_method
m = Module.new
assert_raise(NameError) do