[MacRuby/MacRuby] b78d2b: allow multiple named argument in String#%. fix #13...
Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: b78d2b6130ff7d2460572025b68434c0fbbf93c3 https://github.com/MacRuby/MacRuby/commit/b78d2b6130ff7d2460572025b68434c0fb... Author: Watson <watson1978@gmail.com> Date: 2012-01-28 (Sat, 28 Jan 2012) Changed paths: M sprintf.c Log Message: ----------- allow multiple named argument in String#%. fix #1342 Test Script: ---- require 'test/unit/assertions.rb' include Test::Unit::Assertions assert_equal( "foo, bar", "%{firstname}, %{lastname}" % {firstname: "foo", lastname: "bar"} ) assert_equal( "10, 43.5", "%<integer>d, %<float>.1f" % { integer: 10, float: 43.476374 } ) assert_equal( "10<float>", "%{integer}<float>" % { integer: 10, float: 43.476374 } ) assert_raise(ArgumentError){ "%<foo><bar>" % { foo: 10, bar: 42 } }
participants (1)
-
GitHub