[前][次][番号順一覧][スレッド一覧]

ruby-changes:41280

From: nobu <ko1@a...>
Date: Mon, 28 Dec 2015 09:19:15 +0900 (JST)
Subject: [ruby-changes:41280] nobu:r53352 (trunk): Add test for String#lstrip!

nobu	2015-12-28 09:18:55 +0900 (Mon, 28 Dec 2015)

  New Revision: 53352

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53352

  Log:
    Add test for String#lstrip!
    
    * test/ruby/test_string.rb (TestString#test_lstrip_bang): Add test
      for String#lstrip!.  [Fix GH-1176]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_string.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53351)
+++ ChangeLog	(revision 53352)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Dec 28 09:18:53 2015  Kuniaki IGARASHI  <igaiga@g...>
+
+	* test/ruby/test_string.rb (TestString#test_lstrip_bang): Add test
+	  for String#lstrip!.  [Fix GH-1176]
+
 Sun Dec 27 23:32:26 2015  Masaki Suketa <masaki.suketa@n...>
 
 	* ext/win32ole/win32ole.c (ole_variant2val): refactoring.
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 53351)
+++ test/ruby/test_string.rb	(revision 53352)
@@ -2147,6 +2147,20 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L2147
     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\)/)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]