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
This commit is contained in:
parent
24c3331bdf
commit
b28e537129
@ -148,6 +148,11 @@ class TestSprintf < Test::Unit::TestCase
|
|||||||
assert_equal(" Inf", sprintf("% e", inf), '[ruby-dev:34002]')
|
assert_equal(" Inf", sprintf("% e", inf), '[ruby-dev:34002]')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_hash
|
||||||
|
options = {:capture=>/\d+/}
|
||||||
|
assert_equal("with options {:capture=>/\\d+/}", sprintf("with options %p" % options))
|
||||||
|
end
|
||||||
|
|
||||||
def test_invalid
|
def test_invalid
|
||||||
# Star precision before star width:
|
# Star precision before star width:
|
||||||
assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.**d", 5, 10, 1)}
|
assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.**d", 5, 10, 1)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user