summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-16 03:25:09 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-16 03:25:09 +0000
commitf6f7073e125ff903b77b8cb982a7417d96d51902 (patch)
treec9a4b8cda01244adf12b2f5c97ee8130445168bf
parent632b1e9442d3d5ced2c51b71a85f8f9a47aa9aae (diff)
* test_struct.rb: Test that initialize is overridable [#11708]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--test/ruby/test_struct.rb6
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 87e50453eb..30a9395a4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Dec 16 12:24:59 2015 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
+
+ * test_struct.rb: Test that initialize is overridable [#11708]
+
Wed Dec 16 10:49:51 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (block_command, block_call): fix `&.` calls after
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index 780d344b8e..19a66fb9b1 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