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:
parent
0279a90c73
commit
aafeb4b724
1 changed files with 6 additions and 0 deletions
|
@ -238,6 +238,12 @@ class TestSprintf < Test::Unit::TestCase
|
||||||
assert_equal("with options {:capture=>/\\d+/}", sprintf("with options %p" % options))
|
assert_equal("with options {:capture=>/\\d+/}", sprintf("with options %p" % options))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_inspect
|
||||||
|
obj = Object.new
|
||||||
|
def obj.inspect; "TEST"; end
|
||||||
|
assert_equal("<TEST>", sprintf("<%p>", obj))
|
||||||
|
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…
Reference in a new issue