aboutsummaryrefslogtreecommitdiffstats
path: root/test/ostruct/test_ostruct.rb
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-09-08 15:08:50 -0400
committerMarc-Andre Lafortune <github@marc-andre.ca>2020-09-14 12:46:27 -0400
commite026e186f4a01aa3f6cd02ae6ef33f44f129361c (patch)
tree4ed6005deb54e1b1f4dae538d177577a6c28f431 /test/ostruct/test_ostruct.rb
parent1cabb216c6d44ca948a65544dba73ad75bbc8ec4 (diff)
downloadruby-e026e186f4a01aa3f6cd02ae6ef33f44f129361c.tar.gz
[ruby/ostruct] Revert "ostruct.rb: deferred accessors"
This reverts commits: dc38e99813 22c082fcfd b499e0f9ff 58e5876646 Add test for overriden private methods [Fixes https://bugs.ruby-lang.org/issues/12136]
Diffstat (limited to 'test/ostruct/test_ostruct.rb')
-rw-r--r--test/ostruct/test_ostruct.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 831598086d..3917cc0417 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -179,7 +179,6 @@ class TC_OpenStruct < Test::Unit::TestCase
def test_accessor_defines_method
os = OpenStruct.new(foo: 42)
assert_respond_to(os, :foo)
- assert_equal([], os.singleton_methods)
assert_equal(42, os.foo)
assert_equal([:foo, :foo=], os.singleton_methods.sort)
end
@@ -225,4 +224,10 @@ class TC_OpenStruct < Test::Unit::TestCase
os.foo true, true
end
end
+
+ def test_overriden_private_methods
+ os = OpenStruct.new(puts: :foo, format: :bar)
+ assert_equal(:foo, os.puts)
+ assert_equal(:bar, os.format)
+ end
end