summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-03 15:25:51 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-03 15:25:51 +0000
commitf909bee147b4f7559149da43a5bbfa1e75a9b902 (patch)
treeefc4118580f1f89d3e1d52594bc195e5f8e3d8fb /test
parentf28cfce8cdf5ac82f50fe0f2627697d26fd8bd27 (diff)
merge revision(s) r46569: [Backport #9982]
* 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/branches/ruby_2_1@47376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_sprintf.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb
index 80e69f7fda..eff35c18da 100644
--- a/test/ruby/test_sprintf.rb
+++ b/test/ruby/test_sprintf.rb
@@ -179,6 +179,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