summaryrefslogtreecommitdiff
path: root/test/ostruct/test_ostruct.rb
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2021-06-14 10:07:51 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2021-06-14 12:28:53 -0400
commit52369fc545c458efb2fa7e8ca183b119252bb4f9 (patch)
treed05e0b3390418dec40eba25faeede580fe862f59 /test/ostruct/test_ostruct.rb
parentfc98602ecc0cfbf6bb0fb5925298330a1ab227e0 (diff)
[lib/ostruct] Allow overriding of `block_given?`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4572
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-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 f8d184b011..d2aad4428f 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -110,6 +110,9 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_equal(:foobar, o.delete_field(s) { :baz })
assert_equal(42, OpenStruct.new(foo: 42).delete_field(:foo) { :bug })
+
+ o = OpenStruct.new(block_given?: 42)
+ assert_raise(NameError) { o.delete_field(:foo) }
end
def test_setter