diff options
author | Martin Dürst <duerst@it.aoyama.ac.jp> | 2021-08-17 16:03:52 +0900 |
---|---|---|
committer | Martin Dürst <duerst@it.aoyama.ac.jp> | 2021-08-17 16:03:52 +0900 |
commit | fd7f61cf2133748075f738e5fb171b62190221bc (patch) | |
tree | a44ef654435746bdbc637f0d7829a7abb39a5020 /test | |
parent | a8714b83c40c8736b4ddafef08fa5f0091c9b101 (diff) |
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/enc/test_emoji_breaks.rb | 8 |
1 files changed, 4 insertions, 4 deletions
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 |