diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-26 18:41:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-06-26 18:41:57 +0000 |
commit | cfa7b2283b9b53ff8689d510d486f3488d9254d1 (patch) | |
tree | f2c28977171ce2ca7994080503440c1605624bc4 /test/ruby | |
parent | 545165770bd397e197da7df4e423f3a88d114a76 (diff) | |
download | ruby-cfa7b2283b9b53ff8689d510d486f3488d9254d1.tar.gz |
sprintf.c: unnumbered asterisk with numbered argument
* sprintf.c (GETASTER): should not use the numbered argument to be
formatted, raise ArgumentError instead.
[ruby-dev:48330] [Bug #9982]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_sprintf.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index 2a0fc487c1..7994e99e5e 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -184,6 +184,10 @@ class TestSprintf < Test::Unit::TestCase assert_raise(ArgumentError) { sprintf("%!", 1) } assert_raise(ArgumentError) { sprintf("%1$1$d", 1) } assert_raise(ArgumentError) { sprintf("%0%") } + + assert_raise_with_message(ArgumentError, /unnumbered\(1\) mixed with numbered/) { sprintf("%1$*d", 3) } + assert_raise_with_message(ArgumentError, /unnumbered\(1\) mixed with numbered/) { sprintf("%1$.*d", 3) } + verbose, $VERBOSE = $VERBOSE, nil assert_nothing_raised { sprintf("", 1) } ensure |