mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
2 changed files with 8 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue