mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
632b1e9442
commit
f6f7073e12
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue