diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-28 08:37:32 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-28 08:37:32 +0000 |
commit | 311488a7c67cb2d6a6c0e464ccf8ada54806f4ab (patch) | |
tree | 0bac3a6db831461a32c07aaaa5b845403c7289aa /test/ruby/test_string.rb | |
parent | d4f3a43d0a0501f880c377fb3abf16d121d0fa3f (diff) | |
download | ruby-311488a7c67cb2d6a6c0e464ccf8ada54806f4ab.tar.gz |
implement String/Symbol#casecmp? including Unicode case folding
* string.c: Implement String#casecmp? and Symbol#casecmp? by using
String#downcase :fold for Unicode case folding. This does not include
options such as :turkic, because these currently cannot be combined
with the :fold option. This implements feature #12786.
* test/ruby/test_string.rb/test_symbol.rb: Tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index b1d795e183..90f48e4f08 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2210,6 +2210,13 @@ CODE assert_equal(1, "\u3042B".casecmp("\u3042a")) end + def test_casecmp? + assert_equal(true, 'FoO'.casecmp?('fOO')) + assert_equal(false, 'FoO'.casecmp?('BaR')) + assert_equal(false, 'baR'.casecmp?('FoO')) + assert_equal(true, 'äöü'.casecmp?('ÄÖÜ')) + end + def test_upcase2 assert_equal("\u3042AB", "\u3042aB".upcase) end |