diff options
author | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2019-11-20 17:56:59 +0900 |
---|---|---|
committer | Kazuhiro NISHIYAMA <zn@mbf.nifty.com> | 2019-11-20 17:57:52 +0900 |
commit | 777973084e599cf9efa490173709b187fb507f90 (patch) | |
tree | 44a4579b4c9447e13601eb7e9c6ee30ff7f4d317 /test/ruby | |
parent | 633625a083c5f02e78355cb12818056e54330e88 (diff) | |
download | ruby-777973084e599cf9efa490173709b187fb507f90.tar.gz |
Add tests of argument forwarding's parameters and inspect
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_method.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index be5afab05f..38bcaba622 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -33,6 +33,7 @@ class TestMethod < Test::Unit::TestCase def mk7(a, b = nil, *c, d, **o) nil && o end def mk8(a, b = nil, *c, d, e:, f: nil, **o) nil && o end def mnk(**nil) end + def mf(...) end class Base def foo() :base end @@ -554,6 +555,7 @@ class TestMethod < Test::Unit::TestCase assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:keyrest, :o]], method(:mk7).parameters) assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:keyreq, :e], [:key, :f], [:keyrest, :o]], method(:mk8).parameters) assert_equal([[:nokey]], method(:mnk).parameters) + assert_equal([[:rest, :*], [:block, :&]], method(:mf).parameters) end def test_unbound_parameters @@ -578,6 +580,7 @@ class TestMethod < Test::Unit::TestCase assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:keyrest, :o]], self.class.instance_method(:mk7).parameters) assert_equal([[:req, :a], [:opt, :b], [:rest, :c], [:req, :d], [:keyreq, :e], [:key, :f], [:keyrest, :o]], self.class.instance_method(:mk8).parameters) assert_equal([[:nokey]], self.class.instance_method(:mnk).parameters) + assert_equal([[:rest, :*], [:block, :&]], self.class.instance_method(:mf).parameters) end def test_bmethod_bound_parameters @@ -654,6 +657,7 @@ class TestMethod < Test::Unit::TestCase assert_include(method(:mk7).inspect, "(a, b=..., *c, d, **o)") assert_include(method(:mk8).inspect, "(a, b=..., *c, d, e:, f: ..., **o)") assert_include(method(:mnk).inspect, "(**nil)") + assert_include(method(:mf).inspect, "(**, &&)") end def test_unbound_method_parameters_inspect @@ -678,6 +682,7 @@ class TestMethod < Test::Unit::TestCase assert_include(self.class.instance_method(:mk7).inspect, "(a, b=..., *c, d, **o)") assert_include(self.class.instance_method(:mk8).inspect, "(a, b=..., *c, d, e:, f: ..., **o)") assert_include(self.class.instance_method(:mnk).inspect, "(**nil)") + assert_include(self.class.instance_method(:mf).inspect, "(**, &&)") end def test_public_method_with_zsuper_method |