diff --git a/ChangeLog b/ChangeLog index aaad35df50..b95be78b6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Jan 17 20:40:10 2016 Martin Duerst + + * 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 * enc/unicode.c: Fixed a logical error and some comments. diff --git a/string.c b/string.c index da2030efb9..3267b28664 100644 --- a/string.c +++ b/string.c @@ -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; } diff --git a/test/ruby/enc/test_case_mapping.rb b/test/ruby/enc/test_case_mapping.rb index 6191883637..aea38569ac 100644 --- a/test/ruby/enc/test_case_mapping.rb +++ b/test/ruby/enc/test_case_mapping.rb @@ -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