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

ruby-changes:41256

From: nobu <ko1@a...>
Date: Sun, 27 Dec 2015 11:51:01 +0900 (JST)
Subject: [ruby-changes:41256] nobu:r53328 (trunk): Add tests for String#lstrip and rstrip

nobu	2015-12-27 11:50:56 +0900 (Sun, 27 Dec 2015)

  New Revision: 53328

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

  Log:
    Add tests for String#lstrip and rstrip
    
    * test/ruby/test_string.rb (test_rstrip, test_lstrip): Add tests
      for String#lstrip and rstrip.  The test cases are used from
      string.c ruby-doc comments.  [Fix GH-1174]

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_string.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53327)
+++ ChangeLog	(revision 53328)
@@ -1,7 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Dec 27 11:50:53 2015  Kuniaki IGARASHI  <igaiga@g...>
+
+	* test/ruby/test_string.rb (test_rstrip, test_lstrip): Add tests
+	  for String#lstrip and rstrip.  The test cases are used from
+	  string.c ruby-doc comments.  [Fix GH-1174]
+
 Sun Dec 27 11:47:46 2015  Kuniaki IGARASHI  <igaiga@g...>
 
-	* test/ruby/test_string.rb (test_insert): The test cases are
-	  written in string.c comments as a reference.  [Fix GH-1173]
+	* test/ruby/test_string.rb (test_insert): Add test for
+	  String#test_insert.  The test cases are written in string.c
+	  comments as a reference.  [Fix GH-1173]
 
 Sun Dec 27 11:03:33 2015  Nobuyoshi Nakada  <nobu@r...>
 
Index: test/ruby/test_string.rb
===================================================================
--- test/ruby/test_string.rb	(revision 53327)
+++ test/ruby/test_string.rb	(revision 53328)
@@ -2137,10 +2137,16 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_string.rb#L2137
   end
 
   def test_rstrip
+    assert_equal("  hello", "  hello  ".rstrip)
     assert_equal("\u3042", "\u3042   ".rstrip)
     assert_raise(Encoding::CompatibilityError) { "\u3042".encode("ISO-2022-JP").rstrip }
   end
 
+  def test_lstrip
+    assert_equal("hello  ", "  hello  ".lstrip)
+    assert_equal("\u3042", "   \u3042".lstrip)
+  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/

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