Allow .0 version mismatch to pass the tests

With `make update-unicode`, some tests failed with the following error
due to header mismatch.

* `RbConfig::CONFIG['UNICODE_EMOJI_VERSION']` => 14.0
* the header line is `# emoji-variation-sequences-14.0.0.txt`

So the last `.0` is mismatch.
This patch allows additional `.0` in the header line.

Please revert this patch when a correct patach is merged.

```
  1) Error:
TestEmojiBreaks#test_embedded_emoji:
RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:88:in `block (2 levels) in read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `each'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:111:in `all_tests'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:127:in `test_embedded_emoji'
  2) Error:
TestEmojiBreaks#test_mixed_emoji:
RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:88:in `block (2 levels) in read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `each'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:111:in `all_tests'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:139:in `test_mixed_emoji'
  3) Error:
TestEmojiBreaks#test_single_emoji:
RuntimeError: File Name Mismatch: line: # emoji-variation-sequences-14.0.0.txt, expected filename: emoji-variation-sequences.txt
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:88:in `block (2 levels) in read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `foreach'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:82:in `block in read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `each'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:79:in `read_data'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:111:in `all_tests'
    /tmp/ruby/v3/src/trunk/test/ruby/enc/test_emoji_breaks.rb:117:in `test_single_emoji'
```
This commit is contained in:
Koichi Sasada 2022-03-16 11:30:37 +09:00
parent 5d90c60109
commit fc6e4ce62b

View File

@ -82,7 +82,8 @@ TestEmojiBreaks.data_files_available? and class TestEmojiBreaks
IO.foreach(file.fullname, encoding: Encoding::UTF_8) do |line|
line.chomp!
if $.==1
if line=="# #{file.basename}-#{file.version}.txt"
if line=="# #{file.basename}-#{file.version}.txt" ||
line=="# #{file.basename}-#{file.version}.0.txt"
version_mismatch = false
elsif line!="# #{file.basename}.txt"
raise "File Name Mismatch: line: #{line}, expected filename: #{file.basename}.txt"