mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Add test for String#rstrip!
* test/ruby/test_string.rb (TestString#test_rstrip_bang): Add test for String#rstrip!. [Fix GH-1176] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4ab3c75bc5
commit
2eb5e09ea5
2 changed files with 21 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Dec 28 14:55:57 2015 Kuniaki IGARASHI <igaiga@gmail.com>
|
||||
|
||||
* test/ruby/test_string.rb (TestString#test_rstrip_bang): Add test
|
||||
for String#rstrip!. [Fix GH-1176]
|
||||
|
||||
Mon Dec 28 09:18:53 2015 Kuniaki IGARASHI <igaiga@gmail.com>
|
||||
|
||||
* test/ruby/test_string.rb (TestString#test_lstrip_bang): Add test
|
||||
|
|
|
@ -2142,6 +2142,22 @@ class TestString < Test::Unit::TestCase
|
|||
assert_raise(Encoding::CompatibilityError) { "\u3042".encode("ISO-2022-JP").rstrip }
|
||||
end
|
||||
|
||||
def test_rstrip_bang
|
||||
s1 = S(" hello ")
|
||||
assert_equal(" hello", s1.rstrip!)
|
||||
assert_equal(" hello", s1)
|
||||
|
||||
s2 = S("\u3042 ")
|
||||
assert_equal("\u3042", s2.rstrip!)
|
||||
assert_equal("\u3042", s2)
|
||||
|
||||
s3 = S(" \u3042")
|
||||
assert_equal(nil, s3.rstrip!)
|
||||
assert_equal(" \u3042", s3)
|
||||
|
||||
assert_raise(Encoding::CompatibilityError) { "\u3042".encode("ISO-2022-JP").rstrip! }
|
||||
end
|
||||
|
||||
def test_lstrip
|
||||
assert_equal("hello ", " hello ".lstrip)
|
||||
assert_equal("\u3042", " \u3042".lstrip)
|
||||
|
|
Loading…
Reference in a new issue