From fd7f61cf2133748075f738e5fb171b62190221bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=BCrst?= Date: Tue, 17 Aug 2021 16:03:52 +0900 Subject: Take into account data in emoji-variation-sequences.txt in tests. The emoji data in emoji-variation-sequences.txt was not used for in test/ruby/enc/test_emoji_breaks.rb, for unknown reasons. It turned out that the format of each of the emoji data/test files is slightly different, and that we didn't take into account that empty fields after a semicolon, as present in emoji-variation-sequences.txt, led to less fields than expected when using split. This addresses issue #18027. --- test/ruby/enc/test_emoji_breaks.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/ruby/enc/test_emoji_breaks.rb b/test/ruby/enc/test_emoji_breaks.rb index 1d58e43ffa..cdde4da9bf 100644 --- a/test/ruby/enc/test_emoji_breaks.rb +++ b/test/ruby/enc/test_emoji_breaks.rb @@ -13,7 +13,7 @@ class TestEmojiBreaks::BreakTest @filename = filename @line_number = line_number @comment = comment.gsub(/\s+/, ' ').strip - if filename=='emoji-test' + if filename=='emoji-test' or filename=='emoji-variation-sequences' codes, @type = data.split(/\s*;\s*/) @shortname = '' else @@ -83,16 +83,16 @@ TestEmojiBreaks.data_files_available? and class TestEmojiBreaks line.chomp! raise "File Name Mismatch: line: #{line}, expected filename: #{file.basename}.txt" if $.==1 and not line=="# #{file.basename}.txt" version_mismatch = false if line =~ /^# Version: #{file.version}/ - next if /\A(#|\z)/.match? line + next if line.match?(/\A(#|\z)/) if line =~ /^(\h{4,6})\.\.(\h{4,6}) *(;.+)/ # deal with Unicode ranges in emoji-sequences.txt (Bug #18028) range_start = $1.to_i(16) range_end = $2.to_i(16) rest = $3 (range_start..range_end).each do |code_point| - file_tests << BreakTest.new(file.basename, $., *(code_point.to_s(16)+rest).split('#')) rescue 'whatever' + file_tests << BreakTest.new(file.basename, $., *(code_point.to_s(16)+rest).split('#', 2)) end else - file_tests << BreakTest.new(file.basename, $., *line.split('#')) rescue 'whatever' + file_tests << BreakTest.new(file.basename, $., *line.split('#', 2)) end end raise "File Version Mismatch: file: #{file.fullname}, version: #{file.version}" if version_mismatch -- cgit v1.2.3