aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-25 12:04:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-10-25 12:04:53 +0000
commit5d672b091d8a916b46d590142eb7b22b1bec4526 (patch)
tree0176ed42a448f71a9773913b785a04fe8a337ef1 /test
parent915419fe8b5abc7cd7bca9dc963d2307bb11e68a (diff)
downloadruby-5d672b091d8a916b46d590142eb7b22b1bec4526.tar.gz
io.c: warn old write
* io.c (rb_io_puts): warn if write method accepts just one argument. [ruby-core:83529] [Feature #14042] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index a32369eca5..f16573682b 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2458,6 +2458,22 @@ End
end)
end
+ def test_puts_old_write
+ capture = String.new
+ def capture.write(str)
+ self << str
+ end
+
+ capture.clear
+ assert_warning(/[.#]write is outdated/) do
+ stdout, $stdout = $stdout, capture
+ puts "hey"
+ ensure
+ $stdout = stdout
+ end
+ assert_equal("hey\n", capture)
+ end
+
def test_display
pipe(proc do |w|
"foo".display(w)