mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
32674b167b
commit
0052ed9d80
2 changed files with 27 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Mar 16 15:44:05 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* test/ruby/enc/test_case_mapping.rb: Adding tests for actual Unicode
|
||||
case mapping. Fixing some aliasing issues.
|
||||
(with Kimihito Matsui)
|
||||
|
||||
Tue Mar 15 21:38:28 2016 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* enum.c (enum_inject): Consider redefinition of Fixnum#+.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue