summaryrefslogtreecommitdiff
path: root/test/ostruct
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-03 05:17:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-11-03 05:17:25 +0000
commit4ec86dcc5761a3eaca546ffe121c9d03d7e1e0cd (patch)
tree64ec056c5cd3730d9a1b52fd4c73e1398866c3ad /test/ostruct
parent742d440cba11e4c4a72f6b8d1bbaadc207553243 (diff)
* lib/ostruct.rb (OpenStruct#delete_field): also undefine
accessor methods. [ruby-core:33010] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ostruct')
-rw-r--r--test/ostruct/test_ostruct.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index d920923..5c83bfd 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -48,4 +48,17 @@ class TC_OpenStruct < Test::Unit::TestCase
o.freeze
assert_raise(TypeError, '[ruby-core:22559]') {o.a = 1764}
end
+
+ def test_delete_field
+ bug = '[ruby-core:33010]'
+ o = OpenStruct.new
+ assert_not_respond_to(o, :a)
+ assert_not_respond_to(o, :a=)
+ o.a = 'a'
+ assert_respond_to(o, :a)
+ assert_respond_to(o, :a=)
+ o.delete_field :a
+ assert_not_respond_to(o, :a, bug)
+ assert_not_respond_to(o, :a=, bug)
+ end
end