From e0b4599bba6bea744e0e90b7640dcc21d695c434 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sun, 7 Apr 2019 16:55:34 -0700 Subject: Fix keyword argument separation warnings in test --- test/csv/parse/test_general.rb | 4 ++-- test/csv/test_encodings.rb | 10 +++++----- test/mkmf/base.rb | 4 ++-- test/ruby/test_file.rb | 28 ++++++++++++++-------------- test/ruby/test_io.rb | 4 ++-- test/ruby/test_keyword.rb | 4 ++-- test/ruby/test_optimization.rb | 2 +- test/ruby/test_thread.rb | 4 ++-- test/ruby/test_thread_queue.rb | 2 +- 9 files changed, 31 insertions(+), 31 deletions(-) (limited to 'test') diff --git a/test/csv/parse/test_general.rb b/test/csv/parse/test_general.rb index 49222c7159..f340921854 100644 --- a/test/csv/parse/test_general.rb +++ b/test/csv/parse/test_general.rb @@ -234,10 +234,10 @@ line,5,jkl end private - def assert_parse_errors_out(*args) + def assert_parse_errors_out(*args, **options) assert_raise(CSV::MalformedCSVError) do Timeout.timeout(0.2) do - CSV.parse(*args) + CSV.parse(*args, **options) fail("Parse didn't error out") end end diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb index 64ea36a9a4..151ce7048c 100755 --- a/test/csv/test_encodings.rb +++ b/test/csv/test_encodings.rb @@ -273,19 +273,19 @@ class TestCSVEncodings < Test::Unit::TestCase orig_fields = fields fields = encode_ary(fields, encoding) data = ary_to_data(fields, options) - parsed = CSV.parse(data, options) + parsed = CSV.parse(data, **options) assert_equal(fields, parsed) parsed.flatten.each_with_index do |field, i| assert_equal(encoding, field.encoding, "Field[#{i + 1}] was transcoded.") end File.open(@temp_csv_path, "wb") {|f| f.print(data)} - CSV.open(@temp_csv_path, "rb:#{encoding}", options) do |csv| + CSV.open(@temp_csv_path, "rb:#{encoding}", **options) do |csv| csv.each_with_index do |row, i| assert_equal(fields[i], row) end end begin - CSV.open(@temp_csv_path, "rb:#{encoding}:#{__ENCODING__}", options) do |csv| + CSV.open(@temp_csv_path, "rb:#{encoding}:#{__ENCODING__}", **options) do |csv| csv.each_with_index do |row, i| assert_equal(orig_fields[i], row) end @@ -293,7 +293,7 @@ class TestCSVEncodings < Test::Unit::TestCase rescue Encoding::ConverterNotFoundError end options[:encoding] = encoding.name - CSV.open(@temp_csv_path, options) do |csv| + CSV.open(@temp_csv_path, **options) do |csv| csv.each_with_index do |row, i| assert_equal(fields[i], row) end @@ -302,7 +302,7 @@ class TestCSVEncodings < Test::Unit::TestCase options[:external_encoding] = encoding.name options[:internal_encoding] = __ENCODING__.name begin - CSV.open(@temp_csv_path, options) do |csv| + CSV.open(@temp_csv_path, **options) do |csv| csv.each_with_index do |row, i| assert_equal(orig_fields[i], row) end diff --git a/test/mkmf/base.rb b/test/mkmf/base.rb index cdcf14c0d2..4f67478a56 100644 --- a/test/mkmf/base.rb +++ b/test/mkmf/base.rb @@ -149,7 +149,7 @@ end class TestMkmf include TestMkmf::Base - def assert_separately(args, src, *rest) - super(args + ["-r#{__FILE__}"], "extend TestMkmf::Base; setup\nEND{teardown}\n#{src}", *rest) + def assert_separately(args, src, *rest, **options) + super(args + ["-r#{__FILE__}"], "extend TestMkmf::Base; setup\nEND{teardown}\n#{src}", *rest, **options) end end diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 3deab76e93..ecca8d3e35 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -147,8 +147,8 @@ class TestFile < Test::Unit::TestCase end def test_read_all_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "a" f.rewind @@ -158,8 +158,8 @@ class TestFile < Test::Unit::TestCase end def test_gets_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "a" f.rewind @@ -169,8 +169,8 @@ class TestFile < Test::Unit::TestCase end def test_gets_para_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "\na" f.rewind @@ -180,8 +180,8 @@ class TestFile < Test::Unit::TestCase end def test_each_char_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "a" f.rewind @@ -193,8 +193,8 @@ class TestFile < Test::Unit::TestCase end def test_each_byte_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "a" f.rewind @@ -206,8 +206,8 @@ class TestFile < Test::Unit::TestCase end def test_getc_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "a" f.rewind @@ -217,8 +217,8 @@ class TestFile < Test::Unit::TestCase end def test_getbyte_extended_file - [nil, {:textmode=>true}, {:binmode=>true}].each do |mode| - Tempfile.create("test-extended-file", mode) {|f| + [{}, {:textmode=>true}, {:binmode=>true}].each do |mode| + Tempfile.create("test-extended-file", **mode) {|f| assert_nil(f.getc) f.print "a" f.rewind diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index b47db4f3c2..7849d81fd0 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1395,7 +1395,7 @@ class TestIO < Test::Unit::TestCase def test_dup_many opts = {} opts[:rlimit_nofile] = 1024 if defined?(Process::RLIMIT_NOFILE) - assert_separately([], <<-'End', opts) + assert_separately([], <<-'End', **opts) a = [] assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do loop {a << IO.pipe} @@ -3644,7 +3644,7 @@ __END__ def test_race_gets_and_close opt = { signal: :ABRT, timeout: 200 } - assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}", opt) + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}", **opt) bug13076 = '[ruby-core:78845] [Bug #13076]' begin; 10.times do |i| diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index eda74276e2..ad90acfb0a 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -254,8 +254,8 @@ class TestKeywordArguments < Test::Unit::TestCase [:keyrest, :kw], [:block, :b]], p6.parameters) end - def m1(*args) - yield(*args) + def m1(*args, **options) + yield(*args, **options) end def test_block diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index a39260afc4..ed779fe5a8 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -398,7 +398,7 @@ class TestRubyOptimization < Test::Unit::TestCase foo end;1 end; - status, _err = EnvUtil.invoke_ruby([], "", true, true, {}) { + status, _err = EnvUtil.invoke_ruby([], "", true, true, **{}) { |in_p, out_p, err_p, pid| in_p.write(script) in_p.close diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 3283e30122..e0efb7b2e0 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -961,7 +961,7 @@ _eom cmd = 'Signal.trap(:INT, "DEFAULT"); pipe=IO.pipe; Thread.start {Thread.pass until Thread.main.stop?; puts; STDOUT.flush}; pipe[0].read' opt = {} opt[:new_pgroup] = true if /mswin|mingw/ =~ RUBY_PLATFORM - s, t, _err = EnvUtil.invoke_ruby(['-e', cmd], "", true, true, opt) do |in_p, out_p, err_p, cpid| + s, t, _err = EnvUtil.invoke_ruby(['-e', cmd], "", true, true, **opt) do |in_p, out_p, err_p, cpid| assert IO.select([out_p], nil, nil, 10), 'subprocess not ready' out_p.gets pid = cpid @@ -1337,7 +1337,7 @@ q.pop # prevent SIGABRT from slow shutdown with MJIT opts[:reprieve] = 3 if RubyVM::MJIT.enabled? - assert_normal_exit(<<-_end, '[Bug #8996]', opts) + assert_normal_exit(<<-_end, '[Bug #8996]', **opts) Thread.report_on_exception = false trap(:TERM){exit} while true diff --git a/test/ruby/test_thread_queue.rb b/test/ruby/test_thread_queue.rb index e96107cea7..e46f0b2e8e 100644 --- a/test/ruby/test_thread_queue.rb +++ b/test/ruby/test_thread_queue.rb @@ -134,7 +134,7 @@ class TestThreadQueue < Test::Unit::TestCase timeout = 60 total_count = 250 begin - assert_normal_exit(<<-"_eom", bug5343, {:timeout => timeout, :chdir=>d}) + assert_normal_exit(<<-"_eom", bug5343, **{:timeout => timeout, :chdir=>d}) #{total_count}.times do |i| open("test_thr_kill_count", "w") {|f| f.puts i } queue = Queue.new -- cgit v1.2.3