diff options
author | Mari Imaizumi <[email protected]> | 2025-03-09 15:22:16 +0900 |
---|---|---|
committer | Mari Imaizumi <[email protected]> | 2025-03-18 21:04:02 +0900 |
commit | 75844889eb0169fab62da3063c9bcc950be0ae88 (patch) | |
tree | 55f3b1ee67302894de8f515555bb0d3b7853a858 /test/ruby | |
parent | c7f31c88aeed45607d2abc6b641ad2ccfd77e240 (diff) |
Fix case folding in single byte encoding
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12889
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_regexp.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index be7c6761ca..527636f848 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -2127,13 +2127,16 @@ class TestRegexp < Test::Unit::TestCase end end - def test_bug_16145_caseinsensitive_small_utf # [Bug#16145] - o_acute_lower = 243.chr('UTF-8') - o_acute_upper = 211.chr('UTF-8') - assert_match(/[x#{o_acute_lower}]/i, "abc#{o_acute_upper}", "should match o acute case insensitive") - - e_acute_lower = 233.chr('UTF-8') - e_acute_upper = 201.chr('UTF-8') - assert_match(/[x#{e_acute_lower}]/i, "CAF#{e_acute_upper}", "should match e acute case insensitive") + def test_bug_16145_and_bug_21176_caseinsensitive_small # [Bug#16145] [Bug#21176] + encodings = [Encoding::UTF_8, Encoding::ISO_8859_1] + encodings.each do |enc| + o_acute_lower = "\u00F3".encode(enc) + o_acute_upper = "\u00D3".encode(enc) + assert_match(/[x#{o_acute_lower}]/i, "abc#{o_acute_upper}", "should match o acute case insensitive") + + e_acute_lower = "\u00E9".encode(enc) + e_acute_upper = "\u00C9".encode(enc) + assert_match(/[x#{e_acute_lower}]/i, "CAF#{e_acute_upper}", "should match e acute case insensitive") + end end end |