* 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
This commit is contained in:
marcandre 2015-12-16 03:25:09 +00:00
Родитель 632b1e9442
Коммит f6f7073e12
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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