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
3
io.c
3
io.c
@ -7615,6 +7615,9 @@ rb_io_print(int argc, const VALUE *argv, VALUE out)
|
|||||||
line = rb_lastline_get();
|
line = rb_lastline_get();
|
||||||
argv = &line;
|
argv = &line;
|
||||||
}
|
}
|
||||||
|
if (argc > 1 && !NIL_P(rb_output_fs)) {
|
||||||
|
rb_warn("$, is set to non-nil value");
|
||||||
|
}
|
||||||
for (i=0; i<argc; i++) {
|
for (i=0; i<argc; i++) {
|
||||||
if (!NIL_P(rb_output_fs) && i>0) {
|
if (!NIL_P(rb_output_fs) && i>0) {
|
||||||
rb_io_write(out, rb_output_fs);
|
rb_io_write(out, rb_output_fs);
|
||||||
|
@ -2572,7 +2572,7 @@ class TestIO < Test::Unit::TestCase
|
|||||||
$\ = "\n"
|
$\ = "\n"
|
||||||
pipe(proc do |w|
|
pipe(proc do |w|
|
||||||
w.print('a')
|
w.print('a')
|
||||||
w.print('a','b','c')
|
EnvUtil.suppress_warning {w.print('a','b','c')}
|
||||||
w.close
|
w.close
|
||||||
end, proc do |r|
|
end, proc do |r|
|
||||||
assert_equal("a\n", r.gets)
|
assert_equal("a\n", r.gets)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user