ruby-changes:58861
From: Kazuhiro <ko1@a...>
Date: Wed, 20 Nov 2019 17:58:07 +0900 (JST)
Subject: [ruby-changes:58861] 777973084e (master): Add tests of argument forwarding's parameters and inspect
https://git.ruby-lang.org/ruby.git/commit/?id=777973084e From 777973084e599cf9efa490173709b187fb507f90 Mon Sep 17 00:00:00 2001 From: Kazuhiro NISHIYAMA <zn@m...> Date: Wed, 20 Nov 2019 17:56:59 +0900 Subject: Add tests of argument forwarding's parameters and inspect diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb index be5afab..38bcaba 100644 --- a/test/ruby/test_method.rb +++ b/test/ruby/test_method.rb @@ -33,6 +33,7 @@ class TestMethod < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L33 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L555 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L580 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L657 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_method.rb#L682 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/