1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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 committed by Jeremy Evans
parent 1fb4e28002
commit 8d2333019a
Notes: git 2020-07-18 08:37:58 +09:00
2 changed files with 17 additions and 1 deletions

View file

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

View file

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