Project

General

Profile

Actions

Bug #5763

closed

sprintf not throwing error for wrong number of arguments

Added by chaitanyav (NagaChaitanya Vellanki) about 13 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
-
Backport:
[ruby-core:41656]

Description

sprintf should raise error when the number of arguments does not match the number of format specifiers

sprintf with correct number of format specifiers, arguments

sprintf('%s', 'hello')
=> "hello"

sprintf with a single format specifier and two arguments

sprintf('%s', 'hello', 'world!')
=> "hello"

sprintf with three format specifiers and two arguments

sprintf('%s-%s-%s', 'hello', 'world!')
ArgumentError: too few arguments
from (irb):3:in sprintf' from (irb):3 from /home/chaitanyav/development/tools_64/bin/irb:12:in '


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #2709: $VERBOSE, $DEBUG and Kernel#sprintfRejectedshyouhei (Shyouhei Urabe)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0