aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-18 07:15:07 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-12-18 07:15:07 +0000
commitd2f685eed74fb7b345bf1a75b6023d62d86a1a52 (patch)
treeeaca8d061b5d4860b7bc8be12d9d553bd3a4a07c /test
parent6b718de1d60946a83abf58695838551e62289fed (diff)
downloadruby-d2f685eed74fb7b345bf1a75b6023d62d86a1a52.tar.gz
io.c: opening external command
* io.c (rb_io_open_generic): try to open the named file as usual, if klass is not IO nor File, so that Errno::ENOENT will be raised probably. calling on File will be same in the future. From: Nobuyoshi Nakada <nobu@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 4f6027d8c9..bb16953e99 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2185,16 +2185,17 @@ class TestIO < Test::Unit::TestCase
end
def test_read_command
+ assert_equal("foo\n", IO.read("|echo foo"))
assert_warn(/invoke external command/) do
File.read("|#{EnvUtil.rubybin} -e puts")
end
assert_warn(/invoke external command/) do
File.binread("|#{EnvUtil.rubybin} -e puts")
end
- assert_raise_with_message(ArgumentError, /invoke external command/) do
+ assert_raise(Errno::ENOENT) do
Class.new(IO).read("|#{EnvUtil.rubybin} -e puts")
end
- assert_raise_with_message(ArgumentError, /invoke external command/) do
+ assert_raise(Errno::ENOENT) do
Class.new(IO).binread("|#{EnvUtil.rubybin} -e puts")
end
end