From b28e53712935ba7cb0332263050dd8054278f5b5 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 28 Dec 2013 23:47:27 +0000 Subject: [PATCH] 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 --- test/ruby/test_sprintf.rb | 5 +++++ 1 file changed, 5 insertions(+) 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)}