Fix MonitorMixin when the super's initialize has kwargs

This commit is contained in:
Masataka Pocke Kuwabara 2020-07-11 16:01:05 +09:00 коммит произвёл Jeremy Evans
Родитель 1fb4e28002
Коммит 8d2333019a
2 изменённых файлов: 17 добавлений и 1 удалений

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

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