diff options
author | Jeremy Evans <[email protected]> | 2019-10-04 15:41:13 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2020-01-02 18:40:45 -0800 |
commit | ff96565686c05919bcae3ea77831879e95f67457 (patch) | |
tree | e04eaa5afdaaa942ccfef86648ebfb8a632e8c33 /test/ruby/test_io.rb | |
parent | beae6cbf0fd8b6619e5212552de98022d4c4d4d4 (diff) |
Update tests for full keyword argument separation
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2794
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r-- | test/ruby/test_io.rb | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index c66446d2e8..6bdc7bb27f 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2284,26 +2284,14 @@ class TestIO < Test::Unit::TestCase def o.to_open(**kw); kw; end assert_equal({:a=>1}, open(o, a: 1)) - w = /Using the last argument as keyword parameters is deprecated.*The called method `(to_)?open'/m - redefined = nil - w.singleton_class.define_method(:===) do |s| - match = super(s) - redefined = !$1 - match - end - - assert_warn(w) do - assert_equal({:a=>1}, open(o, {a: 1})) - end + assert_raise(ArgumentError) { open(o, {a: 1}) } class << o remove_method(:to_open) end def o.to_open(kw); kw; end assert_equal({:a=>1}, open(o, a: 1)) - unless redefined - assert_equal({:a=>1}, open(o, {a: 1})) - end + assert_equal({:a=>1}, open(o, {a: 1})) end def test_open_pipe @@ -3138,11 +3126,8 @@ __END__ assert_equal("\00f", File.read(path)) assert_equal(1, File.write(path, "f", 0, encoding: "UTF-8")) assert_equal("ff", File.read(path)) - assert_raise(TypeError) { - assert_warn(/The last argument is split into positional and keyword parameters/) do - File.write(path, "foo", Object.new => Object.new) - end - } + File.write(path, "foo", Object.new => Object.new) + assert_equal("foo", File.read(path)) end end |