diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-15 12:43:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-15 12:43:46 +0000 |
commit | 7b485780a5dda526edd91ac43a89f6b01c51ffbb (patch) | |
tree | 6100df5506b6fcea160eaec74999fb25627b2b86 /test/ostruct/test_ostruct.rb | |
parent | d197d3e56ece2447b9c68bd69f4b7223d1f28a3d (diff) | |
download | ruby-7b485780a5dda526edd91ac43a89f6b01c51ffbb.tar.gz ruby-7b485780a5dda526edd91ac43a89f6b01c51ffbb.tar.xz ruby-7b485780a5dda526edd91ac43a89f6b01c51ffbb.zip |
* lib/ostruct.rb (OpenStruct#new_ostruct_member): checks if frozen.
[ruby-talk:328195], [ruby-core:22142]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@22332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-rw-r--r-- | test/ostruct/test_ostruct.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb index 79662c643..37b7cd137 100644 --- a/test/ostruct/test_ostruct.rb +++ b/test/ostruct/test_ostruct.rb @@ -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 |