mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* lib/ostruct.rb (method_missing): Handle [] and []= correctly.
Based on a patch by Caius Durling, bug #4179 [ruby-core:33792] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40e7d79391
commit
a50bdcd6df
3 changed files with 19 additions and 3 deletions
|
@ -61,4 +61,15 @@ class TC_OpenStruct < Test::Unit::TestCase
|
|||
assert_not_respond_to(o, :a, bug)
|
||||
assert_not_respond_to(o, :a=, bug)
|
||||
end
|
||||
|
||||
def test_method_missing_handles_square_bracket_equals
|
||||
o = OpenStruct.new
|
||||
assert_raise(NoMethodError) { o[:foo] = :bar }
|
||||
end
|
||||
|
||||
def test_method_missing_handles_square_brackets
|
||||
o = OpenStruct.new
|
||||
assert_raise(NoMethodError) { o[:foo] }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue