[前][次][番号順一覧][スレッド一覧]

ruby-changes:43553

From: duerst <ko1@a...>
Date: Sun, 10 Jul 2016 19:33:55 +0900 (JST)
Subject: [ruby-changes:43553] duerst:r55626 (trunk): * test/ruby/enc/test_case_comprehensive.rb: Changed testing logic in to

duerst	2016-07-10 19:33:51 +0900 (Sun, 10 Jul 2016)

  New Revision: 55626

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55626

  Log:
    * test/ruby/enc/test_case_comprehensive.rb: Changed testing logic in to
      catch unintended modifications of characters that do not have a case
      equivalent in the respective encoding.
    * enc/iso_8859_1.c, enc/iso_8859_15.c: Fixed unintended modifications of
      micro sign and y with diaeresis.

  Modified files:
    trunk/ChangeLog
    trunk/enc/iso_8859_1.c
    trunk/enc/iso_8859_15.c
    trunk/test/ruby/enc/test_case_comprehensive.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55625)
+++ ChangeLog	(revision 55626)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jul 10 19:33:47 2016  Martin Duerst  <duerst@i...>
+
+	* test/ruby/enc/test_case_comprehensive.rb: Changed testing logic in to
+	  catch unintended modifications of characters that do not have a case
+	  equivalent in the respective encoding.
+	* enc/iso_8859_1.c, enc/iso_8859_15.c: Fixed unintended modifications of
+	  micro sign and y with diaeresis.
+
 Sun Jul 10 17:05:36 2016  Martin Duerst  <duerst@i...>
 
 	* enc/iso_8859_4.c, test/ruby/enc/test_case_comprehensive.rb:
Index: test/ruby/enc/test_case_comprehensive.rb
===================================================================
--- test/ruby/enc/test_case_comprehensive.rb	(revision 55625)
+++ test/ruby/enc/test_case_comprehensive.rb	(revision 55626)
@@ -165,7 +165,12 @@ class TestComprehensiveCaseFold https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L165
         codepoints.each do |code|
           begin
             source = code.encode(encoding) * 5
-            target = "#{test.first_data[code]}#{test.follow_data[code]*4}".encode(encoding)
+            begin
+              target = "#{test.first_data[code]}#{test.follow_data[code]*4}".encode(encoding)
+            rescue Encoding::UndefinedConversionError
+              raise if code =~ /i|I/ # special case for Turkic
+              target = source
+            end
             result = source.send(test.method_name, *test.attributes)
             assert_equal target, result,
               proc{"from #{code*5} (#{source.dump}) expected #{target.dump} but was #{result.dump}"}
Index: enc/iso_8859_1.c
===================================================================
--- enc/iso_8859_1.c	(revision 55625)
+++ enc/iso_8859_1.c	(revision 55626)
@@ -279,7 +279,7 @@ case_map (OnigCaseFoldType* flagP, const https://github.com/ruby/ruby/blob/trunk/enc/iso_8859_1.c#L279
 	code = 's';
       }
     }
-    else if (code==0xAA || code==0xBA) ;
+    else if (code==0xAA || code==0xBA || code==0xB5 || code==0xFF) ;
     else if ((EncISO_8859_1_CtypeTable[code] & BIT_CTYPE_UPPER)
 	     && (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
       flags |= ONIGENC_CASE_MODIFIED;
Index: enc/iso_8859_15.c
===================================================================
--- enc/iso_8859_15.c	(revision 55625)
+++ enc/iso_8859_15.c	(revision 55626)
@@ -244,7 +244,7 @@ case_map (OnigCaseFoldType* flagP, const https://github.com/ruby/ruby/blob/trunk/enc/iso_8859_15.c#L244
 	code = 's';
       }
     }
-    else if (code==0xAA || code==0xBA) ;
+    else if (code==0xAA || code==0xBA || code==0xB5) ;
     else if ((EncISO_8859_15_CtypeTable[code] & BIT_CTYPE_UPPER)
 	     && (flags & (ONIGENC_CASE_DOWNCASE|ONIGENC_CASE_FOLD))) {
       flags |= ONIGENC_CASE_MODIFIED;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]