aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--enc/unicode.c2
-rw-r--r--test/ruby/enc/test_case_mapping.rb1
-rw-r--r--test/ruby/enc/test_regex_casefold.rb14
4 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 33e702304c..249714c68e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Sat Feb 6 15:18:28 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
+
+ * test/ruby/enc/test_regex_casefold.rb: Added data-based testing for
+ String#downcase :fold.
+
+ * enc/unicode.c: Fixed a range error (lowest non-ASCII character affected
+ by case operations is U+00B5, MICRO SIGN)
+
+ * test/ruby/enc/test_case_mapping.rb: Explicit test for case folding of
+ MICRO SIGN to Greek mu.
+ (with Kimihito Matsui)
+
Sat Feb 6 14:51:23 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* test/ruby/enc/test_regex_casefold.rb: Tests for three case folding
diff --git a/enc/unicode.c b/enc/unicode.c
index cb9b0a94b4..99dc6dc0d3 100644
--- a/enc/unicode.c
+++ b/enc/unicode.c
@@ -645,7 +645,7 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP,
}
}
}
- else if (!(flags&ONIGENC_CASE_ASCII_ONLY) && code>=0x00C0) { /* deal with non-ASCII; nothing relevant below U+00C0 */
+ else if (!(flags&ONIGENC_CASE_ASCII_ONLY) && code>=0x00B5) { /* deal with non-ASCII; micron sign (U+00B5) is lowest affected */
const CodePointList3 *folded;
if (code==0x0130) {
diff --git a/test/ruby/enc/test_case_mapping.rb b/test/ruby/enc/test_case_mapping.rb
index 2c712e448d..0336e3f32f 100644
--- a/test/ruby/enc/test_case_mapping.rb
+++ b/test/ruby/enc/test_case_mapping.rb
@@ -63,6 +63,7 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase
check_downcase_properties 'ss', 'ß', :fold
check_downcase_properties 'fifl', 'fifl', :fold
check_downcase_properties 'σ', 'ς', :fold
+ check_downcase_properties 'μ', 'µ', :fold # MICRO SIGN -> Greek mu
end
def test_turcic
diff --git a/test/ruby/enc/test_regex_casefold.rb b/test/ruby/enc/test_regex_casefold.rb
index 825a02ae06..808ea14c90 100644
--- a/test/ruby/enc/test_regex_casefold.rb
+++ b/test/ruby/enc/test_regex_casefold.rb
@@ -8,6 +8,15 @@ class TestCaseFold < Test::Unit::TestCase
UNICODE_VERSION = UnicodeNormalize::UNICODE_VERSION
CaseTest = Struct.new :source, :target, :kind, :line
+ def check_downcase_properties(expected, start, *flags)
+ assert_equal expected, start.downcase(*flags)
+ temp = start
+ assert_equal expected, temp.downcase!(*flags)
+ assert_equal expected, expected.downcase(*flags)
+ temp = expected
+ assert_nil temp.downcase!(*flags)
+ end
+
def read_tests
IO.readlines(File.expand_path("../../../enc/unicode/data/#{UNICODE_VERSION}/CaseFolding.txt", __dir__))
.collect.with_index { |linedata, linenumber| [linenumber.to_i+1, linedata.chomp] }
@@ -75,7 +84,12 @@ class TestCaseFold < Test::Unit::TestCase
end
end
end
+ end
+ def test_downcase_fold
+ @@tests.each do |test|
+ check_downcase_properties test.target, test.source, :fold
+ end
end
# start with good encodings only