summaryrefslogtreecommitdiff
path: root/test/-ext-/test_printf.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-09 09:16:59 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-09 09:16:59 +0000
commit067d9e9ce97dd42b8b13eef10031b0fa9cf23a1f (patch)
tree934f07816670ae9286f399b18f9b8b78c495bc16 /test/-ext-/test_printf.rb
parent6c3c48e3d569a40774a14a5bfbebf3fc72874de0 (diff)
sprintf.c: NULL as str
* sprintf.c (ruby_vsnprintf, ruby_snprintf): allow NULL as str, just count the expected buffer size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/-ext-/test_printf.rb')
-rw-r--r--test/-ext-/test_printf.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/-ext-/test_printf.rb b/test/-ext-/test_printf.rb
index 4e4f5b4..cd3ba76 100644
--- a/test/-ext-/test_printf.rb
+++ b/test/-ext-/test_printf.rb
@@ -184,4 +184,8 @@ class Test_SPrintf < Test::Unit::TestCase
assert_equal(" a", Bug::Printf.("s", "a", width: 3, prec: 3)[0])
assert_equal("a ", Bug::Printf.("s", "a", minus: true, width: 3, prec: 3)[0])
end
+
+ def test_snprintf_count
+ assert_equal(3, Bug::Printf.sncount("foo"))
+ end
end