1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (rb_io_print): RDoc update. a patch from Daniel Kelley

in [ruby-core:28643].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2010-03-15 08:43:45 +00:00
parent d188e1a852
commit 01657b51f8
3 changed files with 25 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Mon Mar 15 17:28:30 2010 Yukihiro Matsumoto <matz@ruby-lang.org>
* io.c (rb_io_print): RDoc update. a patch from Daniel Kelley
in [ruby-core:28643].
Mon Mar 15 14:06:07 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* random.c (next_state): no initialization here.

4
io.c
View file

@ -5884,7 +5884,9 @@ rb_f_printf(int argc, VALUE *argv)
* ios.print(obj, ...) => nil
*
* Writes the given object(s) to <em>ios</em>. The stream must be
* opened for writing. If the output record separator (<code>$\\</code>)
* opened for writing. If the output field separator (<code>$,</code>)
* is not <code>nil</code>, it will be inserted between each object.
* If the output record separator (<code>$\\</code>)
* is not <code>nil</code>, it will be appended to the output. If no
* arguments are given, prints <code>$_</code>. Objects that aren't
* strings will be converted by calling their <code>to_s</code> method.

View file

@ -1396,6 +1396,23 @@ End
assert_in_out_err(["-", t.path], "print while $<.gets", %w(foo bar baz), [])
end
def test_print_separators
$, = ':'
$\ = "\n"
r, w = IO.pipe
w.print('a')
w.print('a','b','c')
w.close
assert_equal("a\n", r.gets)
assert_equal("a:b:c\n", r.gets)
assert_nil r.gets
r.close
ensure
$, = nil
$\ = nil
end
def test_putc
pipe(proc do |w|
w.putc "A"