[前][次][番号順一覧][スレッド一覧]

ruby-changes:32377

From: nobu <ko1@a...>
Date: Sun, 29 Dec 2013 08:47:37 +0900 (JST)
Subject: [ruby-changes:32377] nobu:r44456 (trunk): test_sprintf.rb: sprintf with a hash as parameter

nobu	2013-12-29 08:47:27 +0900 (Sun, 29 Dec 2013)

  New Revision: 44456

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44456

  Log:
    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]

  Modified files:
    trunk/test/ruby/test_sprintf.rb
Index: test/ruby/test_sprintf.rb
===================================================================
--- test/ruby/test_sprintf.rb	(revision 44455)
+++ test/ruby/test_sprintf.rb	(revision 44456)
@@ -148,6 +148,11 @@ class TestSprintf < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_sprintf.rb#L148
     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)}

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]