Deal with Unicode ranges in the file emoji-sequences.txt

Detect Unicode ranges and loop over them.
This fixes issue #18028.
This commit is contained in:
Martin Dürst 2021-07-27 18:12:24 +09:00
parent c3d31377b3
commit 26b1e6fca8
4 changed files with 13 additions and 1 deletions

1
bin/goruby Symbolic link
View File

@ -0,0 +1 @@
../goruby

1
bin/ruby Symbolic link
View File

@ -0,0 +1 @@
../ruby

1
lib/libruby.so.3.1.0 Symbolic link
View File

@ -0,0 +1 @@
../libruby.so.3.1.0

View File

@ -84,7 +84,16 @@ TestEmojiBreaks.data_files_available? and class TestEmojiBreaks
raise "File Name Mismatch: line: #{line}, expected filename: #{file.basename}.txt" if $.==1 and not line=="# #{file.basename}.txt" 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}/ version_mismatch = false if line =~ /^# Version: #{file.version}/
next if /\A(#|\z)/.match? line next if /\A(#|\z)/.match? line
file_tests << BreakTest.new(file.basename, $., *line.split('#')) rescue 'whatever' 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'
end
else
file_tests << BreakTest.new(file.basename, $., *line.split('#')) rescue 'whatever'
end
end end
raise "File Version Mismatch: file: #{file.fullname}, version: #{file.version}" if version_mismatch raise "File Version Mismatch: file: #{file.fullname}, version: #{file.version}" if version_mismatch
tests += file_tests tests += file_tests