mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Improve error message
ref [Bug #13761] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
84d83482c8
commit
d9d2bbe4b9
2 changed files with 3 additions and 3 deletions
|
@ -521,7 +521,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
|
|||
|
||||
for (t = p; t < end && *t != '%'; t++) ;
|
||||
if (t + 1 == end) {
|
||||
rb_raise(rb_eArgError, "incomplete format specifier");
|
||||
rb_raise(rb_eArgError, "incomplete format specifier; use %%%% (double %%) instead");
|
||||
}
|
||||
PUSH(p, t - p);
|
||||
if (coderange != ENC_CODERANGE_BROKEN && scanned < blen) {
|
||||
|
|
|
@ -425,11 +425,11 @@ class TestSprintf < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_percent_sign_at_end
|
||||
assert_raise_with_message(ArgumentError, "incomplete format specifier") do
|
||||
assert_raise_with_message(ArgumentError, "incomplete format specifier; use %% (double %) instead") do
|
||||
sprintf("%")
|
||||
end
|
||||
|
||||
assert_raise_with_message(ArgumentError, "incomplete format specifier") do
|
||||
assert_raise_with_message(ArgumentError, "incomplete format specifier; use %% (double %) instead") do
|
||||
sprintf("abc%")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue