test_string.rb,test_symbol.rb: add some tests
* test/ruby/test_string.rb: add more test cases for String#casecmp. * test/ruby/test_symbol.rb: ditto for Symbol#{casecmp,casecmp?}. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
47f2bd9334
commit
913afdf95c
@ -2317,6 +2317,9 @@ CODE
|
||||
=end
|
||||
|
||||
def test_casecmp
|
||||
assert_equal(0, "FoO".casecmp("fOO"))
|
||||
assert_equal(1, "FoO".casecmp("BaR"))
|
||||
assert_equal(-1, "baR".casecmp("FoO"))
|
||||
assert_equal(1, "\u3042B".casecmp("\u3042a"))
|
||||
end
|
||||
|
||||
|
@ -286,15 +286,19 @@ class TestSymbol < Test::Unit::TestCase
|
||||
assert_equal(0, :FoO.casecmp(:fOO))
|
||||
assert_equal(1, :FoO.casecmp(:BaR))
|
||||
assert_equal(-1, :baR.casecmp(:FoO))
|
||||
|
||||
assert_nil(:foo.casecmp("foo"))
|
||||
assert_nil(:foo.casecmp(Object.new))
|
||||
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?(:ÄÖÜ))
|
||||
|
||||
assert_nil(:foo.casecmp?("foo"))
|
||||
assert_nil(:foo.casecmp?(Object.new))
|
||||
end
|
||||
|
||||
def test_length
|
||||
|
Loading…
x
Reference in New Issue
Block a user