diff options
Diffstat (limited to 'test/ruby/test_sprintf.rb')
-rw-r--r-- | test/ruby/test_sprintf.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_sprintf.rb b/test/ruby/test_sprintf.rb index 163d37256c..7986e9d141 100644 --- a/test/ruby/test_sprintf.rb +++ b/test/ruby/test_sprintf.rb @@ -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)} |