1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix keyword argument separation warnings in test

This commit is contained in:
Jeremy Evans 2019-04-07 16:55:34 -07:00
parent d08e1004e0
commit e0b4599bba
Notes: git 2019-08-31 04:40:17 +09:00
9 changed files with 31 additions and 31 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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|

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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