aboutsummaryrefslogtreecommitdiffstats
path: root/test/ostruct
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2020-09-24 19:30:22 +0900
committerYusuke Endoh <mame@ruby-lang.org>2020-09-24 19:30:22 +0900
commit4405423c871698c36e4e4f24d89f17033b18b19c (patch)
treeeebec154ced9f188c3f22ae812a7d030dda35321 /test/ostruct
parent416bb11a5e9c4062295392765191cdedcecc522a (diff)
downloadruby-4405423c871698c36e4e4f24d89f17033b18b19c.tar.gz
test/ostruct/test_ostruct.rb: Prevent "method redefined; discarding old foo"
Diffstat (limited to 'test/ostruct')
-rw-r--r--test/ostruct/test_ostruct.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 8fa7ba6229..0628094306 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -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