aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-28 00:18:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-28 00:18:55 +0000
commit78d15f5e351073c30c0fa0b8eca1f07a728c3bcc (patch)
tree6f419b76e4affd77ca2547856b4d88f668c0f7d1 /test/ruby/test_string.rb
parentb8d9770b6c699af6e63dab727621777fbfbf7b44 (diff)
downloadruby-78d15f5e351073c30c0fa0b8eca1f07a728c3bcc.tar.gz
Add test for String#lstrip!
* test/ruby/test_string.rb (TestString#test_lstrip_bang): Add test for String#lstrip!. [Fix GH-1176] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 96137e3de9..778a817fdc 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -2147,6 +2147,20 @@ class TestString < Test::Unit::TestCase
assert_equal("\u3042", " \u3042".lstrip)
end
+ def test_lstrip_bang
+ s1 = S(" hello ")
+ assert_equal("hello ", s1.lstrip!)
+ assert_equal("hello ", s1)
+
+ s2 = S("\u3042 ")
+ assert_equal(nil, s2.lstrip!)
+ assert_equal("\u3042 ", s2)
+
+ s3 = S(" \u3042")
+ assert_equal("\u3042", s3.lstrip!)
+ assert_equal("\u3042", s3)
+ end
+
=begin
def test_symbol_table_overflow
assert_in_out_err([], <<-INPUT, [], /symbol table overflow \(symbol [a-z]{8}\) \(RuntimeError\)/)