зеркало из https://github.com/github/ruby.git
Prefer to use File.readlines instead of IO.readlines
This commit is contained in:
Родитель
ae4d8e99f1
Коммит
d3d8cd304f
|
@ -360,7 +360,7 @@ def get_included(file)
|
|||
file_name = File.join dir, file
|
||||
|
||||
if File.exist? file_name then
|
||||
included = IO.readlines file_name
|
||||
included = File.readlines file_name
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class TestCaseFold < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def read_tests
|
||||
IO.readlines("#{UNICODE_DATA_PATH}/CaseFolding.txt", encoding: Encoding::ASCII_8BIT)
|
||||
File.readlines("#{UNICODE_DATA_PATH}/CaseFolding.txt", encoding: Encoding::ASCII_8BIT)
|
||||
.collect.with_index { |linedata, linenumber| [linenumber.to_i+1, linedata.chomp] }
|
||||
.reject { |number, data| data =~ /^(#|$)/ }
|
||||
.collect do |linenumber, linedata|
|
||||
|
|
|
@ -1266,7 +1266,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
begin;
|
||||
class Bug < RuntimeError
|
||||
def backtrace
|
||||
IO.readlines(IO::NULL)
|
||||
File.readlines(IO::NULL)
|
||||
end
|
||||
end
|
||||
bug = Bug.new '[ruby-core:85939] [Bug #14577]'
|
||||
|
|
|
@ -24,7 +24,7 @@ class TestUnicodeNormalize
|
|||
NormTest = Struct.new :source, :NFC, :NFD, :NFKC, :NFKD, :line
|
||||
|
||||
def self.read_tests
|
||||
lines = IO.readlines(expand_filename('NormalizationTest'), encoding: 'utf-8')
|
||||
lines = File.readlines(expand_filename('NormalizationTest'), encoding: 'utf-8')
|
||||
firstline = lines.shift
|
||||
define_method "test_0_normalizationtest_firstline" do
|
||||
assert_include(firstline, "NormalizationTest-#{UNICODE_VERSION}.txt")
|
||||
|
|
Загрузка…
Ссылка в новой задаче