summaryrefslogtreecommitdiff
path: root/test/test_mutex_m.rb
diff options
context:
space:
mode:
authorMasataka Pocke Kuwabara <p.ck.t22@gmail.com>2020-11-24 00:37:13 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-12-04 19:53:16 +0900
commit60b57866ac64ef8a21951c7d5ff7b7f98e1ce15f (patch)
treec7cd8de6204d8d39999ef0bc4150401caa7fd82f /test/test_mutex_m.rb
parentda126250ba31cd341b434b86047cf4ebde4e2539 (diff)
[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
Diffstat (limited to 'test/test_mutex_m.rb')
-rw-r--r--test/test_mutex_m.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/test_mutex_m.rb b/test/test_mutex_m.rb
index 30971dd..e5cfbc8 100644
--- a/test/test_mutex_m.rb
+++ b/test/test_mutex_m.rb
@@ -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