summaryrefslogtreecommitdiff
path: root/test/ostruct
diff options
context:
space:
mode:
authorMarc-Andre Lafortune <github@marc-andre.ca>2020-09-25 20:55:38 -0400
committerMarc-André Lafortune <github@marc-andre.ca>2020-09-30 18:11:24 -0400
commitdf4d08c44ac3e96336d29a360aafdc4b2a3e96fc (patch)
tree2a47ee14fc92eaee93bbaf6a82e573ab96f09f37 /test/ostruct
parentfb16c3dce2e629f9c443f9615df18cf2bbb3a077 (diff)
[ruby/ostruct] Avoid calling initialize
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3593
Diffstat (limited to 'test/ostruct')
-rw-r--r--test/ostruct/test_ostruct.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index 0628094306..8e1aedd896 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -204,6 +204,15 @@ class TC_OpenStruct < Test::Unit::TestCase
assert_instance_of(c, os)
end
+ def test_initialize_subclass
+ c = Class.new(OpenStruct) {
+ def initialize(x,y={})super(y);end
+ }
+ o = c.new(1, {a: 42})
+ assert_equal(42, o.dup.a)
+ assert_equal(42, o.clone.a)
+ end
+
def test_private_method
os = OpenStruct.new
class << os