mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00

added hand-coded support for Turkic, fixed logic for swapcase. * string.c: Made use of new case mapping code possible from upcase, capitalize, and swapcase (with :lithuanian as a guard). * test/ruby/enc/test_case_mapping.rb: Adjusted for above. (with Kimihito Matsui) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53562 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
34 lines
1.5 KiB
Ruby
34 lines
1.5 KiB
Ruby
# Copyright © 2016 Kimihito Matsui (松井 仁人) and Martin J. Dürst (duerst@it.aoyama.ac.jp)
|
||
|
||
require "test/unit"
|
||
|
||
# preliminary tests, using :lithuanian as a guard
|
||
# to test new implementation strategy
|
||
class TestCaseMappingPreliminary < Test::Unit::TestCase
|
||
def test_ascii
|
||
assert_equal 'yukihiro matsumoto (matz)',
|
||
'Yukihiro MATSUMOTO (MATZ)'.downcase(:lithuanian)
|
||
assert_equal 'YUKIHIRO MATSUMOTO (MATZ)',
|
||
'yukihiro matsumoto (matz)'.upcase(:lithuanian)
|
||
assert_equal 'Yukihiro matsumoto (matz)',
|
||
'yukihiro MATSUMOTO (MATZ)'.capitalize(:lithuanian)
|
||
assert_equal 'yUKIHIRO matsumoto (MAtz)',
|
||
'Yukihiro MATSUMOTO (maTZ)'.swapcase(:lithuanian)
|
||
end
|
||
|
||
def test_turcic
|
||
assert_equal 'yukihiro matsumoto (matz)',
|
||
'Yukihiro MATSUMOTO (MATZ)'.downcase(:turkic, :lithuanian)
|
||
assert_equal 'YUKİHİRO MATSUMOTO (MATZ)',
|
||
'Yukihiro Matsumoto (matz)'.upcase(:turkic, :lithuanian)
|
||
end
|
||
|
||
def no_longer_a_test_buffer_allocations
|
||
assert_equal 'TURKISH*ı'*10, ('I'*10).downcase(:turkic, :lithuanian)
|
||
assert_equal 'TURKISH*ı'*100, ('I'*100).downcase(:turkic, :lithuanian)
|
||
assert_equal 'TURKISH*ı'*1_000, ('I'*1_000).downcase(:turkic, :lithuanian)
|
||
assert_equal 'TURKISH*ı'*10_000, ('I'*10_000).downcase(:turkic, :lithuanian)
|
||
assert_equal 'TURKISH*ı'*100_000, ('I'*100_000).downcase(:turkic, :lithuanian)
|
||
assert_equal 'TURKISH*ı'*1_000_000, ('I'*1_000_000).downcase(:turkic, :lithuanian)
|
||
end
|
||
end
|