ruby-changes:8200
From: mame <ko1@a...>
Date: Thu, 9 Oct 2008 22:16:24 +0900 (JST)
Subject: [ruby-changes:8200] Ruby:r19728 (trunk): * test/ruby/test_module.rb (test_remove_class_variable): add a test
mame 2008-10-09 22:16:07 +0900 (Thu, 09 Oct 2008) New Revision: 19728 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19728 Log: * 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. Modified files: trunk/ChangeLog trunk/test/ruby/test_module.rb trunk/test/ruby/test_object.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19727) +++ ChangeLog (revision 19728) @@ -1,3 +1,11 @@ +Thu Oct 9 22:13:58 2008 Yusuke Endoh <mame@t...> + + * 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. + Thu Oct 9 22:04:38 2008 Yusuke Endoh <mame@t...> * variable.c (rb_mod_remove_cvar): fix r19711. Index: test/ruby/test_module.rb =================================================================== --- test/ruby/test_module.rb (revision 19727) +++ test/ruby/test_module.rb (revision 19728) @@ -210,14 +210,6 @@ 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 @@ 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 @@ 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 @@ 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 Index: test/ruby/test_object.rb =================================================================== --- test/ruby/test_object.rb (revision 19727) +++ test/ruby/test_object.rb (revision 19728) @@ -170,6 +170,13 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/