mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/ostruct/test_ostruct.rb: Prevent "method redefined; discarding old foo"
This commit is contained in:
parent
416bb11a5e
commit
4405423c87
1 changed files with 3 additions and 0 deletions
|
@ -184,12 +184,15 @@ class TC_OpenStruct < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_does_not_redefine
|
||||
$VERBOSE, verbose_bak = nil, $VERBOSE
|
||||
os = OpenStruct.new(foo: 42)
|
||||
def os.foo
|
||||
43
|
||||
end
|
||||
os.foo = 44
|
||||
assert_equal(43, os.foo)
|
||||
ensure
|
||||
$VERBOSE = verbose_bak
|
||||
end
|
||||
|
||||
def test_allocate_subclass
|
||||
|
|
Loading…
Add table
Reference in a new issue