diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-28 23:47:27 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-28 23:47:27 +0000 |
commit | b28e53712935ba7cb0332263050dd8054278f5b5 (patch) | |
tree | 0d51b6e73f135f23a0886590dc0968ee142daaaf | |
parent | 24c3331bdfa47339de70e5866132bf872e6d9d90 (diff) | |
download | ruby-b28e53712935ba7cb0332263050dd8054278f5b5.tar.gz |
test_sprintf.rb: sprintf with a hash as parameter
* test/ruby/test_sprintf.rb (test_hash): Added tests for sprintf
with a hash as parameter. [Fixes GH-491]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_sprintf.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index 80e69f7fda..a57509f458 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -148,6 +148,11 @@ class TestSprintf < Test::Unit::TestCase assert_equal(" Inf", sprintf("% e", inf), '[ruby-dev:34002]') end + def test_hash + options = {:capture=>/\d+/} + assert_equal("with options {:capture=>/\\d+/}", sprintf("with options %p" % options)) + end + def test_invalid # Star precision before star width: assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.**d", 5, 10, 1)} |