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

Test to disable ASCII-only optimization

Examples why ASCII-only optimization cannot apply multi-byte
encodings which have 7-bit trailing bytes.

Suggested by @duerst at https://github.com/ruby/ruby/pull/2187#issuecomment-492949218
This commit is contained in:
Nobuyoshi Nakada 2019-05-17 09:53:47 +09:00
parent 23751a2681
commit 0971cab4d0
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -210,6 +210,16 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase
assert_equal "\u10D0\u10D1\u10D2", "\u10D0\u10D1\u10D2".capitalize
end
def test_shift_jis_downcase_ascii
s = ("A".."Z").map {|c| "\x89#{c}"}.join("").force_encoding("Shift_JIS")
assert_equal s, s.downcase(:ascii)
end
def test_shift_jis_upcase_ascii
s = ("a".."z").map {|c| "\x89#{c}"}.join("").force_encoding("Shift_JIS")
assert_equal s, s.upcase(:ascii)
end
def no_longer_a_test_buffer_allocations
assert_equal 'TURKISH*ı'*10, ('I'*10).downcase(:turkic)
assert_equal 'TURKISH*ı'*100, ('I'*100).downcase(:turkic)