ruby-changes:41065
From: marcandre <ko1@a...>
Date: Wed, 16 Dec 2015 12:25:18 +0900 (JST)
Subject: [ruby-changes:41065] marcandRe: r53140 (trunk): * test_struct.rb: Test that initialize is overridable [#11708]
marcandre 2015-12-16 12:25:09 +0900 (Wed, 16 Dec 2015) New Revision: 53140 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53140 Log: * test_struct.rb: Test that initialize is overridable [#11708] Modified files: trunk/ChangeLog trunk/test/ruby/test_struct.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 53139) +++ ChangeLog (revision 53140) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Dec 16 12:24:59 2015 Marc-Andre Lafortune <ruby-core@m...> + + * test_struct.rb: Test that initialize is overridable [#11708] + Wed Dec 16 10:49:51 2015 Nobuyoshi Nakada <nobu@r...> * parse.y (block_command, block_call): fix `&.` calls after Index: test/ruby/test_struct.rb =================================================================== --- test/ruby/test_struct.rb (revision 53139) +++ test/ruby/test_struct.rb (revision 53140) @@ -94,6 +94,12 @@ module TestStruct https://github.com/ruby/ruby/blob/trunk/test/ruby/test_struct.rb#L94 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/