summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_struct.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index 780d344b8ec..19a66fb9b17 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -94,6 +94,12 @@ module TestStruct
def test_initialize
klass = @Struct.new(:a)
assert_raise(ArgumentError) { klass.new(1, 2) }
+ klass = @Struct.new(:total) do
+ def initialize(a, b)
+ super(a+b)
+ end
+ end
+ assert_equal 3, klass.new(1,2).total
end
def test_each