ruby-changes:57456
From: Yusuke <ko1@a...>
Date: Sun, 1 Sep 2019 15:25:28 +0900 (JST)
Subject: [ruby-changes:57456] Yusuke Endoh: 02dfa0f163 (master): test/ruby/test_keyword.rb: Add remove_method before method redefinition
https://git.ruby-lang.org/ruby.git/commit/?id=02dfa0f163 From 02dfa0f16361c498e0f529054b00e3e09730892b Mon Sep 17 00:00:00 2001 From: Yusuke Endoh <mame@r...> Date: Sun, 1 Sep 2019 15:24:37 +0900 Subject: test/ruby/test_keyword.rb: Add remove_method before method redefinition to suppress redefinition warnings. diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index cd8eeec..11fe44f 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -321,6 +321,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L321 assert_equal([h2], c.method(:m)[**h2]) assert_equal([h3], c.method(:m)[**h3]) + c.singleton_class.remove_method(:m) def c.m; end assert_nil(c.method(:m)[**{}]) assert_nil(c.method(:m)[**kw]) @@ -328,6 +329,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L329 assert_raise(ArgumentError) { c.method(:m)[**h2] } assert_raise(ArgumentError) { c.method(:m)[**h3] } + c.singleton_class.remove_method(:m) def c.m(args) args end @@ -337,6 +339,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L339 assert_equal(h2, c.method(:m)[**h2]) assert_equal(h3, c.method(:m)[**h3]) + c.singleton_class.remove_method(:m) def c.m(**args) args end @@ -346,6 +349,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L349 assert_equal(h2, c.method(:m)[**h2]) assert_equal(h3, c.method(:m)[**h3]) + c.singleton_class.remove_method(:m) def c.m(arg, **args) [arg, args] end @@ -355,6 +359,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L359 assert_equal([h2, kw], c.method(:m)[**h2]) assert_equal([h3, kw], c.method(:m)[**h3]) + c.singleton_class.remove_method(:m) def c.m(arg=1, **args) [arg=1, args] end @@ -381,6 +386,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L386 assert_equal([h2], c.send(:m, **h2)) assert_equal([h3], c.send(:m, **h3)) + c.singleton_class.remove_method(:m) def c.m; end assert_nil(c.send(:m, **{})) assert_nil(c.send(:m, **kw)) @@ -388,6 +394,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L394 assert_raise(ArgumentError) { c.send(:m, **h2) } assert_raise(ArgumentError) { c.send(:m, **h3) } + c.singleton_class.remove_method(:m) def c.m(args) args end @@ -397,6 +404,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L404 assert_equal(h2, c.send(:m, **h2)) assert_equal(h3, c.send(:m, **h3)) + c.singleton_class.remove_method(:m) def c.m(**args) args end @@ -406,6 +414,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L414 assert_equal(h2, c.send(:m, **h2)) assert_equal(h3, c.send(:m, **h3)) + c.singleton_class.remove_method(:m) def c.m(arg, **args) [arg, args] end @@ -423,6 +432,7 @@ class TestKeywordArguments < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_keyword.rb#L432 assert_equal([h3, kw], c.send(:m, **h3)) end + c.singleton_class.remove_method(:m) def c.m(arg=1, **args) [arg=1, args] end -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/