From aafeb4b724e91e4cd7eb6da01ec68d7c60a78cc1 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 15 Sep 2018 08:39:07 +0000 Subject: test_sprintf.rb: test for %p git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_sprintf.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby/test_sprintf.rb') 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("", sprintf("<%p>", obj)) + end + def test_invalid # Star precision before star width: assert_raise(ArgumentError, "[ruby-core:11569]") {sprintf("%.**d", 5, 10, 1)} -- cgit v1.2.3