mirror of
https://github.com/ruby/ruby.git
synced 2025-09-19 10:33:58 +02:00
* lib/ostruct.rb (OpenStruct#new_ostruct_member): checks if frozen.
[ruby-talk:328195], [ruby-core:22142] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8fc45476eb
commit
a4eb339564
3 changed files with 25 additions and 8 deletions
|
@ -34,4 +34,12 @@ class TC_OpenStruct < Test::Unit::TestCase
|
|||
foo.bar.foo = foo
|
||||
assert_equal('#<OpenStruct bar=#<OpenStruct foo=#<OpenStruct ...>>>', foo.inspect)
|
||||
end
|
||||
|
||||
def test_frozen
|
||||
o = OpenStruct.new
|
||||
o.a = 'a'
|
||||
o.freeze
|
||||
assert_raise(TypeError) {o.b = 'b'}
|
||||
assert_not_respond_to(o, :b)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue