aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-10 10:33:51 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-07-10 10:33:51 +0000
commit5260ddf810395858150b3608ed7a7f1fa75321a2 (patch)
tree7dc78a951a4d65a34a71a9e111ad6d3c4eab5a28
parent28726b84855a7623d25c8bd9884078f4711316b5 (diff)
downloadruby-5260ddf810395858150b3608ed7a7f1fa75321a2.tar.gz
* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--enc/iso_8859_1.c2
-rw-r--r--enc/iso_8859_15.c2
-rw-r--r--test/ruby/enc/test_case_comprehensive.rb7
4 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c6f4435d11..b23d8317c9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sun Jul 10 19:33:47 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * 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@it.aoyama.ac.jp>
* enc/iso_8859_4.c, test/ruby/enc/test_case_comprehensive.rb:
diff --git a/enc/iso_8859_1.c b/enc/iso_8859_1.c
index d12a8dfc51..ad3d4a531a 100644
--- a/enc/iso_8859_1.c
+++ b/enc/iso_8859_1.c
@@ -279,7 +279,7 @@ case_map (OnigCaseFoldType* flagP, const OnigUChar** pp,
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;
diff --git a/enc/iso_8859_15.c b/enc/iso_8859_15.c
index 066a08c9fb..5180383331 100644
--- a/enc/iso_8859_15.c
+++ b/enc/iso_8859_15.c
@@ -244,7 +244,7 @@ case_map (OnigCaseFoldType* flagP, const OnigUChar** pp,
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;
diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb
index bd30166de3..d1d1c3b282 100644
--- a/test/ruby/enc/test_case_comprehensive.rb
+++ b/test/ruby/enc/test_case_comprehensive.rb
@@ -165,7 +165,12 @@ class TestComprehensiveCaseFold
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}"}