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

ruby-changes:14713

From: yugui <ko1@a...>
Date: Thu, 4 Feb 2010 12:58:18 +0900 (JST)
Subject: [ruby-changes:14713] Ruby:r26568 (ruby_1_9_1): merges r26052 from trunk into ruby_1_9_1.

yugui	2010-02-04 12:48:25 +0900 (Thu, 04 Feb 2010)

  New Revision: 26568

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

  Log:
    merges r26052 from trunk into ruby_1_9_1.
    --
    * string.c (rb_str_justify): fixed the case a fill size is a
      multiple of the length of the padding.  [ruby-dev:39856]

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/string.c
    branches/ruby_1_9_1/test/ruby/test_string.rb
    branches/ruby_1_9_1/version.h

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 26567)
+++ ruby_1_9_1/ChangeLog	(revision 26568)
@@ -1,3 +1,8 @@
+Wed Dec  9 09:50:35 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (rb_str_justify): fixed the case a fill size is a
+	  multiple of the length of the padding.  [ruby-dev:39856]
+
 Sat Oct 31 17:19:28 2009  NAKAMURA, Hiroshi  <nahi@r...>
 
 	* lib/net/http.rb (Net::HTTPResponse#each_response_header):
Index: ruby_1_9_1/string.c
===================================================================
--- ruby_1_9_1/string.c	(revision 26567)
+++ ruby_1_9_1/string.c	(revision 26568)
@@ -6515,7 +6515,7 @@
        p += llen;
     }
     else {
-       while (llen > fclen) {
+       while (llen >= fclen) {
 	    memcpy(p,f,flen);
 	    p += flen;
 	    llen -= fclen;
@@ -6532,7 +6532,7 @@
        p += rlen;
     }
     else {
-       while (rlen > fclen) {
+       while (rlen >= fclen) {
 	    memcpy(p,f,flen);
 	    p += flen;
 	    rlen -= fclen;
Index: ruby_1_9_1/version.h
===================================================================
--- ruby_1_9_1/version.h	(revision 26567)
+++ ruby_1_9_1/version.h	(revision 26568)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.1"
-#define RUBY_PATCHLEVEL 418
+#define RUBY_PATCHLEVEL 419
 #define RUBY_VERSION_MAJOR 1
 #define RUBY_VERSION_MINOR 9
 #define RUBY_VERSION_TEENY 1
Index: ruby_1_9_1/test/ruby/test_string.rb
===================================================================
--- ruby_1_9_1/test/ruby/test_string.rb	(revision 26567)
+++ ruby_1_9_1/test/ruby/test_string.rb	(revision 26568)
@@ -320,9 +320,12 @@
    
   end
 
+  Bug2463 = '[ruby-dev:39856]'
   def test_center
     assert_equal(S("hello"),       S("hello").center(4))
     assert_equal(S("   hello   "), S("hello").center(11))
+    assert_equal(S("ababaababa"), S("").center(10, "ab"), Bug2463)
+    assert_equal(S("ababaababab"), S("").center(11, "ab"), Bug2463)
   end
 
   def test_chomp
@@ -779,6 +782,8 @@
   def test_ljust
     assert_equal(S("hello"),       S("hello").ljust(4))
     assert_equal(S("hello      "), S("hello").ljust(11))
+    assert_equal(S("ababababab"), S("").ljust(10, "ab"), Bug2463)
+    assert_equal(S("abababababa"), S("").ljust(11, "ab"), Bug2463)
   end
 
   def test_next
@@ -917,6 +922,8 @@
   def test_rjust
     assert_equal(S("hello"), S("hello").rjust(4))
     assert_equal(S("      hello"), S("hello").rjust(11))
+    assert_equal(S("ababababab"), S("").rjust(10, "ab"), Bug2463)
+    assert_equal(S("abababababa"), S("").rjust(11, "ab"), Bug2463)
   end
 
   def test_scan

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

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