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

* string.c: Any kind of option is now taking the new code path for

upcase/downcase/capitalize/swapcase. :lithuanian can be used for
  testing if no specific option is desired.
* test/ruby/enc/test_case_mapping.rb: Adjusted to above.
  (with Kimihito Matsui)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2016-01-17 11:40:46 +00:00
parent f307d1fe21
commit e580847ce8
3 changed files with 15 additions and 6 deletions

View file

@ -1,3 +1,11 @@
Sun Jan 17 20:40:10 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* string.c: Any kind of option is now taking the new code path for
upcase/downcase/capitalize/swapcase. :lithuanian can be used for
testing if no specific option is desired.
* test/ruby/enc/test_case_mapping.rb: Adjusted to above.
(with Kimihito Matsui)
Sun Jan 17 20:10:10 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
* enc/unicode.c: Fixed a logical error and some comments.

View file

@ -5734,7 +5734,7 @@ rb_str_upcase_bang(int argc, VALUE *argv, VALUE str)
enc = STR_ENC_GET(str);
rb_str_check_dummy_enc(enc);
s = RSTRING_PTR(str); send = RSTRING_END(str);
if (enc==rb_utf8_encoding() && flags&ONIGENC_CASE_FOLD_LITHUANIAN) { /* lithuanian temporarily used as a guard for debugging */
if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
modify = ONIGENC_CASE_MODIFIED & flags;
}
@ -5821,7 +5821,7 @@ rb_str_downcase_bang(int argc, VALUE *argv, VALUE str)
enc = STR_ENC_GET(str);
rb_str_check_dummy_enc(enc);
s = RSTRING_PTR(str); send = RSTRING_END(str);
if (enc==rb_utf8_encoding() && flags&ONIGENC_CASE_FOLD_LITHUANIAN) { /* lithuanian temporarily used as a guard for debugging */
if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
modify = ONIGENC_CASE_MODIFIED & flags;
}
@ -5917,7 +5917,7 @@ rb_str_capitalize_bang(int argc, VALUE *argv, VALUE str)
enc = STR_ENC_GET(str);
rb_str_check_dummy_enc(enc);
if (RSTRING_LEN(str) == 0 || !RSTRING_PTR(str)) return Qnil;
if (enc==rb_utf8_encoding() && flags&ONIGENC_CASE_FOLD_LITHUANIAN) { /* lithuanian temporarily used as a guard for debugging */
if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
modify = ONIGENC_CASE_MODIFIED & flags;
}
@ -5989,7 +5989,7 @@ rb_str_swapcase_bang(int argc, VALUE *argv, VALUE str)
enc = STR_ENC_GET(str);
rb_str_check_dummy_enc(enc);
s = RSTRING_PTR(str); send = RSTRING_END(str);
if (enc==rb_utf8_encoding() && flags&ONIGENC_CASE_FOLD_LITHUANIAN) { /* lithuanian temporarily used as a guard for debugging */
if (enc==rb_utf8_encoding() && argc>0) { /* :lithuanian can temporarily be used for new functionality without options */
str_shared_replace(str, rb_str_casemap(str, &flags, enc));
modify = ONIGENC_CASE_MODIFIED & flags;
}

View file

@ -50,8 +50,9 @@ class TestCaseMappingPreliminary < Test::Unit::TestCase
end
def test_turcic
check_downcase_properties 'yukihiro matsumoto (matz)', 'Yukihiro MATSUMOTO (MATZ)', :turkic, :lithuanian
check_upcase_properties 'YUKİHİRO MATSUMOTO (MATZ)', 'Yukihiro Matsumoto (matz)', :turkic, :lithuanian
check_downcase_properties 'yukihiro matsumoto (matz)', 'Yukihiro MATSUMOTO (MATZ)', :turkic
check_upcase_properties 'YUKİHİRO MATSUMOTO (MATZ)', 'Yukihiro Matsumoto (matz)', :turkic
check_downcase_properties "yuki\u0307hi\u0307ro matsumoto (matz)", 'YUKİHİRO MATSUMOTO (MATZ)', :lithuanian
end
def no_longer_a_test_buffer_allocations