1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_sprintf.rb: test for %p

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-09-15 08:39:07 +00:00
parent 0279a90c73
commit aafeb4b724

View file

@ -238,6 +238,12 @@ class TestSprintf < Test::Unit::TestCase
assert_equal("with options {:capture=>/\\d+/}", sprintf("with options %p" % options))
end
def test_inspect
obj = Object.new
def obj.inspect; "TEST"; end
assert_equal("<TEST>", sprintf("<%p>", obj))
end
def test_invalid
# Star precision before star width:
assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.**d", 5, 10, 1)}