1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_string.rb (test_chop, test_chop!): tests for [ruby-core:23155].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-04-08 10:48:52 +00:00
parent 8b95a0df1b
commit c9ad044dfb

View file

@ -405,6 +405,7 @@ class TestString < Test::Unit::TestCase
assert_equal(S("hello\n"), S("hello\n\r").chop) assert_equal(S("hello\n"), S("hello\n\r").chop)
assert_equal(S(""), S("\r\n").chop) assert_equal(S(""), S("\r\n").chop)
assert_equal(S(""), S("").chop) assert_equal(S(""), S("").chop)
assert_equal(S("a").hash, S("a\u00d8").chop.hash)
end end
def test_chop! def test_chop!
@ -423,6 +424,10 @@ class TestString < Test::Unit::TestCase
a = S("").chop! a = S("").chop!
assert_nil(a) assert_nil(a)
a = S("a\u00d8")
a.chop!
assert_equal(S("a").hash, a.hash)
a = S("hello\n") a = S("hello\n")
b = a.dup b = a.dup
assert_equal(S("hello"), a.chop!) assert_equal(S("hello"), a.chop!)