ruby-changes:14230
From: nobu <ko1@a...>
Date: Wed, 9 Dec 2009 09:50:55 +0900 (JST)
Subject: [ruby-changes:14230] Ruby:r26052 (trunk): * string.c (rb_str_justify): fixed the case a fill size is a
nobu 2009-12-09 09:50:37 +0900 (Wed, 09 Dec 2009) New Revision: 26052 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26052 Log: * 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: trunk/ChangeLog trunk/string.c trunk/test/ruby/test_string.rb trunk/version.h Index: ChangeLog =================================================================== --- ChangeLog (revision 26051) +++ ChangeLog (revision 26052) @@ -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] + Tue Dec 8 23:41:34 2009 NAKAMURA Usaku <usa@r...> * win32/configure.bat: now recognize --with-*-{dir,include,lib} options Index: string.c =================================================================== --- string.c (revision 26051) +++ string.c (revision 26052) @@ -6635,7 +6635,7 @@ p += llen; } else { - while (llen > fclen) { + while (llen >= fclen) { memcpy(p,f,flen); p += flen; llen -= fclen; @@ -6652,7 +6652,7 @@ p += rlen; } else { - while (rlen > fclen) { + while (rlen >= fclen) { memcpy(p,f,flen); p += flen; rlen -= fclen; Index: version.h =================================================================== --- version.h (revision 26051) +++ version.h (revision 26052) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_RELEASE_DATE "2009-12-08" +#define RUBY_RELEASE_DATE "2009-12-09" #define RUBY_PATCHLEVEL -1 #define RUBY_BRANCH_NAME "trunk" @@ -8,7 +8,7 @@ #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 12 -#define RUBY_RELEASE_DAY 8 +#define RUBY_RELEASE_DAY 9 #include "ruby/version.h" Index: test/ruby/test_string.rb =================================================================== --- test/ruby/test_string.rb (revision 26051) +++ test/ruby/test_string.rb (revision 26052) @@ -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/