зеркало из https://github.com/github/ruby.git
Fix MonitorMixin when the super's initialize has kwargs
This commit is contained in:
Родитель
1fb4e28002
Коммит
8d2333019a
|
@ -220,7 +220,7 @@ module MonitorMixin
|
|||
# Use <tt>extend MonitorMixin</tt> or <tt>include MonitorMixin</tt> instead
|
||||
# of this constructor. Have look at the examples above to understand how to
|
||||
# use this module.
|
||||
def initialize(*args)
|
||||
def initialize(...)
|
||||
super
|
||||
mon_initialize
|
||||
end
|
||||
|
|
|
@ -236,6 +236,22 @@ class TestMonitor < Test::Unit::TestCase
|
|||
assert NewCondTest.new.cond.instance_variable_get(:@monitor) != nil
|
||||
end
|
||||
|
||||
class KeywordInitializeParent
|
||||
def initialize(x:)
|
||||
end
|
||||
end
|
||||
|
||||
class KeywordInitializeChild < KeywordInitializeParent
|
||||
include MonitorMixin
|
||||
def initialize
|
||||
super(x: 1)
|
||||
end
|
||||
end
|
||||
|
||||
def test_initialize_with_keyword_arg
|
||||
assert KeywordInitializeChild.new
|
||||
end
|
||||
|
||||
def test_timedwait
|
||||
cond = @monitor.new_cond
|
||||
b = "foo"
|
||||
|
|
Загрузка…
Ссылка в новой задаче