summaryrefslogtreecommitdiffhomepage
path: root/test/t/string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/string.rb')
-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
-