mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Warn non-nil $,
in IO#print
too
This commit is contained in:
parent
0ed3384fd4
commit
588a86e32c
Notes:
git
2020-02-23 16:49:04 +09:00
2 changed files with 4 additions and 1 deletions
3
io.c
3
io.c
|
@ -7615,6 +7615,9 @@ rb_io_print(int argc, const VALUE *argv, VALUE out)
|
|||
line = rb_lastline_get();
|
||||
argv = &line;
|
||||
}
|
||||
if (argc > 1 && !NIL_P(rb_output_fs)) {
|
||||
rb_warn("$, is set to non-nil value");
|
||||
}
|
||||
for (i=0; i<argc; i++) {
|
||||
if (!NIL_P(rb_output_fs) && i>0) {
|
||||
rb_io_write(out, rb_output_fs);
|
||||
|
|
|
@ -2572,7 +2572,7 @@ class TestIO < Test::Unit::TestCase
|
|||
$\ = "\n"
|
||||
pipe(proc do |w|
|
||||
w.print('a')
|
||||
w.print('a','b','c')
|
||||
EnvUtil.suppress_warning {w.print('a','b','c')}
|
||||
w.close
|
||||
end, proc do |r|
|
||||
assert_equal("a\n", r.gets)
|
||||
|
|
Loading…
Add table
Reference in a new issue