summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-11-25 08:01:41 +0900
committerGitHub <[email protected]>2016-11-25 08:01:41 +0900
commitb4d501750cc5c98ed0a04f56d5eb95fb178bcca3 (patch)
treeebf09e0708230bd6298ead4a6c6c8136d497d520 /test
parent54921aa671f91d24e4025c0a54b4c622fc2f6db2 (diff)
parent76a1bdfa29469576112a41b78a132b785616a3f9 (diff)
downloadmruby-b4d501750cc5c98ed0a04f56d5eb95fb178bcca3.tar.gz
mruby-b4d501750cc5c98ed0a04f56d5eb95fb178bcca3.zip
Merge pull request #3288 from bouk/chomp-bang-len
Get String length after args in String#chomp!
Diffstat (limited to 'test')
-rw-r--r--test/t/string.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/t/string.rb b/test/t/string.rb
index e67389b5c..80fcbe6fa 100644
--- a/test/t/string.rb
+++ b/test/t/string.rb
@@ -251,6 +251,19 @@ assert('String#chomp!', '15.2.10.5.10') do
assert_equal 'abc', e
end
+assert('String#chomp! uses the correct length') do
+ class A
+ def to_str
+ $s.replace("AA")
+ "A"
+ end
+ end
+
+ $s = "AAA"
+ $s.chomp!(A.new)
+ assert_equal $s, "A"
+end
+
assert('String#chop', '15.2.10.5.11') do
a = ''.chop
b = 'abc'.chop
@@ -683,4 +696,3 @@ assert('String#freeze') do
assert_raise(RuntimeError) { str.upcase! }
end
-