diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-16 06:44:05 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-16 06:44:05 +0000 |
commit | b4de38406953a6974db0576688301ef63a87fcdf (patch) | |
tree | b709b882e70f4eca5f0b296ebb0ced8d429618f1 /test | |
parent | 1951c820294e07a3017bf31c341e831491c45db0 (diff) | |
download | ruby-b4de38406953a6974db0576688301ef63a87fcdf.tar.gz |
* test/ruby/enc/test_case_mapping.rb: Adding tests for actual Unicode
case mapping. Fixing some aliasing issues.
(with Kimihito Matsui)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/enc/test_case_mapping.rb | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/test/ruby/enc/test_case_mapping.rb b/test/ruby/enc/test_case_mapping.rb index 0336e3f32f..d0bcd7620c 100644 --- a/test/ruby/enc/test_case_mapping.rb +++ b/test/ruby/enc/test_case_mapping.rb @@ -8,31 +8,39 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase # checks, including idempotence and non-modification; not always guaranteed def check_upcase_properties(expected, start, *flags) assert_equal expected, start.upcase(*flags) - temp = start + temp = start.dup assert_equal expected, temp.upcase!(*flags) assert_equal expected, expected.upcase(*flags) - temp = expected + temp = expected.dup assert_nil temp.upcase!(*flags) end def check_downcase_properties(expected, start, *flags) assert_equal expected, start.downcase(*flags) - temp = start + temp = start.dup assert_equal expected, temp.downcase!(*flags) assert_equal expected, expected.downcase(*flags) - temp = expected + temp = expected.dup assert_nil temp.downcase!(*flags) end def check_capitalize_properties(expected, start, *flags) assert_equal expected, start.capitalize(*flags) - temp = start + temp = start.dup assert_equal expected, temp.capitalize!(*flags) assert_equal expected, expected.capitalize(*flags) - temp = expected + temp = expected.dup assert_nil temp.capitalize!(*flags) end + def check_capitalize_suffixes(lower, upper) + while not upper.length > 1 + lower = lower[1..-1] + check_capitalize_properties upper[0]+lower, upper, :lithuanian + upper = upper[1..-1] + end + end + # different properties; careful: roundtrip isn't always guaranteed def check_swapcase_properties(expected, start, *flags) assert_equal expected, start.swapcase(*flags) @@ -49,6 +57,13 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase check_swapcase_properties 'yUKIHIRO matsumoto (MAtz)', 'Yukihiro MATSUMOTO (maTZ)', :lithuanian end + def test_general + check_downcase_properties 'résumé dürst ĭñŧėřŋãţijňőńæłĩżàťïōņ', 'RÉSUMÉ DÜRST ĬÑŦĖŘŊÃŢIJŇŐŃÆŁĨŻÀŤÏŌŅ', :lithuanian + check_upcase_properties 'RÉSUMÉ DÜRST ĬÑŦĖŘŊÃŢIJŇŐŃÆŁĨŻÀŤÏŌŅ', 'résumé dürst ĭñŧėřŋãţijňőńæłĩżàťïōņ', :lithuanian + check_capitalize_suffixes 'résumé dürst ĭñŧėřŋãţijňőńæłĩżàťïōņ', 'RÉSUMÉ DÜRST ĬÑŦĖŘŊÃŢIJŇŐŃÆŁĨŻÀŤÏŌŅ' + check_swapcase_properties 'résumé DÜRST ĭñŧėřŊÃŢIJŇŐŃæłĩżàťïōņ', 'RÉSUMÉ dürst ĬÑŦĖŘŋãţijňőńÆŁĨŻÀŤÏŌŅ', :lithuanian + end + def test_ascii_option check_downcase_properties 'yukihiro matsumoto (matz)', 'Yukihiro MATSUMOTO (MATZ)', :ascii check_upcase_properties 'YUKIHIRO MATSUMOTO (MATZ)', 'yukihiro matsumoto (matz)', :ascii |