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

sprintf.c: remove extra parentheses

* sprintf.c (GETASTER): remove extra parentheses from the second
  argument so that the error message does not contain them.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-06-26 13:30:08 +00:00
parent 767358108e
commit 57d6cb4af9
2 changed files with 7 additions and 1 deletions

View file

@ -120,7 +120,7 @@ sign_bits(int base, const char *p)
#define GETASTER(val) do { \
t = p++; \
n = 0; \
GETNUM(n, (val)); \
GETNUM(n, val); \
if (*p == '$') { \
tmp = GETPOSARG(n); \
} \

View file

@ -309,6 +309,12 @@ class TestSprintf < Test::Unit::TestCase
def test_star
assert_equal("-1 ", sprintf("%*d", -3, -1))
assert_raise_with_message(ArgumentError, /width too big/) {
sprintf("%*999999999999999999999999999999999999999999999999999999999999$d", 1)
}
assert_raise_with_message(ArgumentError, /prec too big/) {
sprintf("%.*999999999999999999999999999999999999999999999999999999999999$d", 1)
}
end
def test_escape