aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_symbol.rb
diff options
context:
space:
mode:
authorduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-28 08:37:32 +0000
committerduerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-28 08:37:32 +0000
commitad619e02c465eebd15fa57dc658f8e042decdebb (patch)
tree0bac3a6db831461a32c07aaaa5b845403c7289aa /test/ruby/test_symbol.rb
parentbd2fd73196bbff7dc5349c624342e212c09d174e (diff)
downloadruby-ad619e02c465eebd15fa57dc658f8e042decdebb.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_symbol.rb')
-rw-r--r--test/ruby/test_symbol.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index d8c91c1eea..24d319211f 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -276,6 +276,14 @@ class TestSymbol < Test::Unit::TestCase
assert_nil(:foo.casecmp("foo"))
end
+ def test_casecmp?
+ assert_equal(true, :FoO.casecmp?(:fOO))
+ assert_equal(false, :FoO.casecmp?(:BaR))
+ assert_equal(false, :baR.casecmp?(:FoO))
+ assert_nil(:foo.casecmp?("foo"))
+ assert_equal(true, :äöü.casecmp?(:ÄÖÜ))
+ end
+
def test_length
assert_equal(3, :FoO.length)
assert_equal(3, :FoO.size)