From 5e9d33ad49079877ee9461e0449150a28bf0902d Mon Sep 17 00:00:00 2001 From: duerst Date: Fri, 1 Apr 2016 11:58:47 +0000 Subject: * enc/unicode/case-folding.rb, casefold.h: Data generation to implement swapcase functionality for titlecase characters. Swapcase isn't defined by Unicode, because the purpose/usage of swapcase is unclear anyway. The implementation follows a proposal from Nobu, swaping the case of each component of a titlecase character individually. This means that the titlecase characters have to be decomposed. * enc/unicode.c: Code using the above data. * test/ruby/enc/test_case_mapping.rb: Tests for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/enc/test_case_mapping.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/enc/test_case_mapping.rb b/test/ruby/enc/test_case_mapping.rb index b52d86b57a..5fb7339eeb 100644 --- a/test/ruby/enc/test_case_mapping.rb +++ b/test/ruby/enc/test_case_mapping.rb @@ -93,6 +93,19 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase check_capitalize_properties 'Nj', 'nj', :lithuanian end + def test_swapcase + assert_equal 'dZ', 'Dz'.swapcase(:lithuanian) + assert_equal 'dŽ', 'Dž'.swapcase(:lithuanian) + assert_equal 'lJ', 'Lj'.swapcase(:lithuanian) + assert_equal 'nJ', 'Nj'.swapcase(:lithuanian) + assert_equal 'ἀΙ', 'ᾈ'.swapcase(:lithuanian) + assert_equal 'ἣΙ', 'ᾛ'.swapcase(:lithuanian) + assert_equal 'ὧΙ', 'ᾯ'.swapcase(:lithuanian) + assert_equal 'αΙ', 'ᾼ'.swapcase(:lithuanian) + assert_equal 'ηΙ', 'ῌ'.swapcase(:lithuanian) + assert_equal 'ωΙ', 'ῼ'.swapcase(: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 -- cgit v1.2.3