diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-02-27 16:38:32 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-02-27 18:49:18 +0900 |
commit | db0a4c8923e0e084c7d757d132a83fc9c8431633 (patch) | |
tree | 1ea1f2e494962c6e8c024bd1a60719f305a40341 /test/ruby/enc | |
parent | d063ed12afcb56d919863d6efb4bfa92741c1555 (diff) |
Prefer to use File.foreach instead of IO.foreach
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7387
Diffstat (limited to 'test/ruby/enc')
-rw-r--r-- | test/ruby/enc/test_case_comprehensive.rb | 2 | ||||
-rw-r--r-- | test/ruby/enc/test_emoji_breaks.rb | 2 | ||||
-rw-r--r-- | test/ruby/enc/test_grapheme_breaks.rb | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb index bc57d57ee4..de18ac865c 100644 --- a/test/ruby/enc/test_case_comprehensive.rb +++ b/test/ruby/enc/test_case_comprehensive.rb @@ -37,7 +37,7 @@ TestComprehensiveCaseMapping.data_files_available? and class TestComprehensiveC end def self.read_data_file(filename) - IO.foreach(expand_filename(filename), encoding: Encoding::ASCII_8BIT) do |line| + File.foreach(expand_filename(filename), encoding: Encoding::ASCII_8BIT) do |line| if $. == 1 if filename == 'UnicodeData' elsif line.start_with?("# #{filename}-#{UNICODE_VERSION}.txt") diff --git a/test/ruby/enc/test_emoji_breaks.rb b/test/ruby/enc/test_emoji_breaks.rb index 3e2999d61e..bb5114680e 100644 --- a/test/ruby/enc/test_emoji_breaks.rb +++ b/test/ruby/enc/test_emoji_breaks.rb @@ -75,7 +75,7 @@ class TestEmojiBreaks < Test::Unit::TestCase EMOJI_DATA_FILES.each do |file| version_mismatch = true file_tests = [] - IO.foreach(file.fullname, encoding: Encoding::UTF_8) do |line| + File.foreach(file.fullname, encoding: Encoding::UTF_8) do |line| line.chomp! if $.==1 if line=="# #{file.basename}-#{file.version}.txt" diff --git a/test/ruby/enc/test_grapheme_breaks.rb b/test/ruby/enc/test_grapheme_breaks.rb index f4e3c93b47..7e6d722d40 100644 --- a/test/ruby/enc/test_grapheme_breaks.rb +++ b/test/ruby/enc/test_grapheme_breaks.rb @@ -44,7 +44,7 @@ class TestGraphemeBreaksFromFile < Test::Unit::TestCase if file_available? def read_data tests = [] - IO.foreach(GRAPHEME_BREAK_TEST_FILE, encoding: Encoding::UTF_8) do |line| + File.foreach(GRAPHEME_BREAK_TEST_FILE, encoding: Encoding::UTF_8) do |line| if $. == 1 and not line.start_with?("# GraphemeBreakTest-#{UNICODE_VERSION}.txt") raise "File Version Mismatch" end |