mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/mutex_m] Fix Mutex_m#initialize
when the super's initialize has kwargs
Co-authored-by: Ryuta Kamizono <kamipo@gmail.com> https://github.com/ruby/mutex_m/commit/84ca1fc108
This commit is contained in:
parent
da126250ba
commit
60b57866ac
2 changed files with 33 additions and 0 deletions
|
@ -113,4 +113,5 @@ module Mutex_m
|
|||
mu_initialize
|
||||
super
|
||||
end
|
||||
ruby2_keywords(:initialize) if respond_to?(:ruby2_keywords, true)
|
||||
end
|
||||
|
|
|
@ -23,4 +23,36 @@ class TestMutexM < Test::Unit::TestCase
|
|||
c.signal
|
||||
assert_equal "abc", t.value
|
||||
end
|
||||
|
||||
class KeywordInitializeParent
|
||||
def initialize(x:)
|
||||
end
|
||||
end
|
||||
|
||||
class KeywordInitializeChild < KeywordInitializeParent
|
||||
include Mutex_m
|
||||
def initialize
|
||||
super(x: 1)
|
||||
end
|
||||
end
|
||||
|
||||
def test_initialize_with_keyword_arg
|
||||
assert KeywordInitializeChild.new
|
||||
end
|
||||
|
||||
class NoArgInitializeParent
|
||||
def initialize
|
||||
end
|
||||
end
|
||||
|
||||
class NoArgInitializeChild < NoArgInitializeParent
|
||||
include Mutex_m
|
||||
def initialize
|
||||
super()
|
||||
end
|
||||
end
|
||||
|
||||
def test_initialize_no_args
|
||||
assert NoArgInitializeChild.new
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue