summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGary Tou <gary@garytou.com>2023-04-26 09:08:16 -0400
committerAaron Patterson <aaron.patterson@gmail.com>2023-04-26 10:21:20 -0400
commit78be6696d864513ffad395ecd37d582143ca1216 (patch)
tree0c8b34311ef7581c3bacd6fb283fdd85261677b9 /test
parent96a2e27185475d4b9138ecda4f38a35621d1d085 (diff)
downloadruby-78be6696d864513ffad395ecd37d582143ca1216.tar.gz
Wrap `undef_method :a` with `ensure`
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_defined.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index 1af3bd0cb3..b9bf939394 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -311,9 +311,9 @@ class TestDefined < Test::Unit::TestCase
end
assert_nil(a)
-
+ ensure
BasicObject.class_eval do
- undef_method :a
+ undef_method :a if defined?(a)
end
end