1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sprintf.c (rb_f_sprintf): should not check positional number as

width.  [ruby-core:11838]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-08-02 04:46:41 +00:00
parent 12b1e59f2e
commit 46e848a65a
4 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,8 @@
Thu Aug 2 13:46:39 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* sprintf.c (rb_f_sprintf): should not check positional number as
width. [ruby-core:11838]
Wed Aug 1 12:40:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Wed Aug 1 12:40:05 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* generic.rb (URI::Generic::merge_path): behave as RFC 3986. * generic.rb (URI::Generic::merge_path): behave as RFC 3986.

View file

@ -349,7 +349,6 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
case '1': case '2': case '3': case '4': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': case '5': case '6': case '7': case '8': case '9':
CHECK_FOR_WIDTH(flags);
n = 0; n = 0;
GETNUM(n, width); GETNUM(n, width);
if (*p == '$') { if (*p == '$') {
@ -360,6 +359,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
p++; p++;
goto retry; goto retry;
} }
CHECK_FOR_WIDTH(flags);
width = n; width = n;
flags |= FWIDTH; flags |= FWIDTH;
goto retry; goto retry;

View file

@ -1,6 +1,10 @@
require 'test/unit' require 'test/unit'
class TestSprintf < Test::Unit::TestCase class TestSprintf < Test::Unit::TestCase
def test_positional
assert_equal(" 00001", sprintf("%*1$.*2$3$d", 10, 5, 1))
end
def test_binary def test_binary
assert_equal("0", sprintf("%b", 0)) assert_equal("0", sprintf("%b", 0))
assert_equal("1", sprintf("%b", 1)) assert_equal("1", sprintf("%b", 1))

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-08-01" #define RUBY_RELEASE_DATE "2007-08-02"
#define RUBY_VERSION_CODE 190 #define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070801 #define RUBY_RELEASE_CODE 20070802
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 1 #define RUBY_RELEASE_DAY 2
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];