summaryrefslogtreecommitdiff
path: root/test/ostruct
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-09-08 16:30:02 -0400
committerMarc-Andre Lafortune <github@marc-andre.ca>2020-09-14 12:46:47 -0400
commit8eefa8f3736cd5dbf7256f571b368198102f11cc (patch)
treee1205bfed121928c06167c99cbc900208e30da8e /test/ostruct
parentebb8de730269a8c18a553e3dea7a7603b13d2328 (diff)
downloadruby-8eefa8f3736cd5dbf7256f571b368198102f11cc.tar.gz
[ruby/ostruct] Allow overriding public methods
[Fixes https://bugs.ruby-lang.org/issues/15409]
Diffstat (limited to 'test/ostruct')
-rw-r--r--test/ostruct/test_ostruct.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 0688d8950c..3c934ccbec 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -235,4 +235,10 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_equal(:foo, os.puts)
assert_equal(:bar, os.format)
end
+
+ def test_overriden_public_methods
+ os = OpenStruct.new(method: :foo, class: :bar)
+ assert_equal(:foo, os.method)
+ assert_equal(:bar, os.class)
+ end
end