ruby-changes:44868
From: duerst <ko1@a...>
Date: Wed, 30 Nov 2016 17:25:51 +0900 (JST)
Subject: [ruby-changes:44868] duerst:r56941 (trunk): fix uppercasing for U+A64B, CYRILLIC SMALL LETTER MONOGRAPH UK
duerst 2016-11-30 17:25:46 +0900 (Wed, 30 Nov 2016) New Revision: 56941 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56941 Log: fix uppercasing for U+A64B, CYRILLIC SMALL LETTER MONOGRAPH UK * enc/unicode.c: Add U+A64B to the special cases 03B9 and 03BC at the end of onigenc_unicode_case_map (Bug #12990). * enc/unicode/case-folding.rb: Add U+A64B to the special cases 03B9 and 03BC. Add a comment pointing to enc/unicode.c. Change warnings to exceptions for unpredicted cases, because this would have been more easily noticed (the warning was not noticed when upgrading to Unicode 9.0.0). * test/ruby/enc/test_case_comprehensive.rb: Remove temporary exclusion of U+A64B from testing. Modified files: trunk/enc/unicode/case-folding.rb trunk/enc/unicode.c trunk/test/ruby/enc/test_case_comprehensive.rb Index: enc/unicode.c =================================================================== --- enc/unicode.c (revision 56940) +++ enc/unicode.c (revision 56941) @@ -777,8 +777,8 @@ onigenc_unicode_case_map(OnigCaseFoldTyp https://github.com/ruby/ruby/blob/trunk/enc/unicode.c#L777 code = folded->code[0]; } else if ((flags&(ONIGENC_CASE_UPCASE)) - && (code==0x03B9||code==0x03BC)) { /* GREEK SMALL LETTERs IOTA/MU */ - MODIFIED; + && (code==0x03B9||code==0x03BC||code==0xA64B)) { /* GREEK SMALL LETTERs IOTA/MU, */ + MODIFIED; /* CYRILLIC SMALL LETTER MONOGRAPH UK */ code = folded->code[1]; } } Index: enc/unicode/case-folding.rb =================================================================== --- enc/unicode/case-folding.rb (revision 56940) +++ enc/unicode/case-folding.rb (revision 56941) @@ -296,17 +296,19 @@ class CaseMapping https://github.com/ruby/ruby/blob/trunk/enc/unicode/case-folding.rb#L296 when item.upper then flags += '|U' when item.lower then flags += '|D' else - unless from=='03B9' or from=='03BC' - warn 'Unpredicted case 0; check data or adjust program (enc/unicode/case_folding.rb).' + unless from=='03B9' or from=='03BC' or from=='A64B' + # cf. code==0x03B9||code==0x03BC||code==0xA64B in enc/unicode.c, + # towards the end of function onigenc_unicode_case_map + raise "Unpredicted case 0 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." end end unless item.upper == item.title if item.code == item.title - warn 'Unpredicted case 1; check data or adjust program (enc/unicode/case_folding.rb).' + raise "Unpredicted case 1 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." elsif item.title==to[1] flags += '|ST' else - warn 'Unpredicted case 2; check data or adjust program (enc/unicode/case_folding.rb).' + raise "Unpredicted case 2 in enc/unicode/case_folding.rb. Please contact https://bugs.ruby-lang.org/." end end end Index: test/ruby/enc/test_case_comprehensive.rb =================================================================== --- test/ruby/enc/test_case_comprehensive.rb (revision 56940) +++ test/ruby/enc/test_case_comprehensive.rb (revision 56941) @@ -146,8 +146,6 @@ TestComprehensiveCaseFold.data_files_ava https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L146 attributes.prepend '_' unless attributes.empty? define_method "test_#{encoding}_#{test.method_name}#{attributes}" do @@codepoints.each do |code| - next if code=="\uA64B" # temporarily exclude this character from testing, - # see https://bugs.ruby-lang.org/issues/12990 source = code.encode(encoding) * 5 target = "#{test.first_data[code]}#{test.follow_data[code]*4}".encode(encoding) result = source.__send__(test.method_name, *test.attributes) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/