diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-22 08:07:38 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-22 08:07:38 +0000 |
commit | 873b56fd50e12294601bbe96b1bef3b2c2428010 (patch) | |
tree | e1d786a4090aab4ea878efa2cd56db93fae132c5 | |
parent | e093cfae7af6304d3ba4427ab27ac6e2d352bf82 (diff) | |
download | ruby-873b56fd50e12294601bbe96b1bef3b2c2428010.tar.gz |
* io.c (rb_io_s_foreach): return enumerator including kerword
arguments. [ruby-dev:45267][Bug #6054]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | io.c | 2 | ||||
-rw-r--r-- | test/ruby/test_io.rb | 3 |
3 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Feb 22 17:07:35 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * io.c (rb_io_s_foreach): return enumerator including kerword + arguments. [ruby-dev:45267][Bug #6054] + Wed Feb 22 15:47:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * common.mk (test-all): shut up nonsense skipping messages. @@ -8971,8 +8971,8 @@ rb_io_s_foreach(int argc, VALUE *argv, VALUE self) VALUE opt; struct foreach_arg arg; - argc = rb_scan_args(argc, argv, "13:", NULL, NULL, NULL, NULL, &opt); RETURN_ENUMERATOR(self, argc, argv); + argc = rb_scan_args(argc, argv, "13:", NULL, NULL, NULL, NULL, &opt); open_key_args(argc, argv, opt, &arg); if (NIL_P(arg.io)) return Qnil; return rb_ensure(io_s_foreach, (VALUE)&arg, rb_io_close, arg.io); diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 9fbe321452..54253c1f99 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1605,6 +1605,9 @@ End IO.foreach(t.path, "b", 3) {|x| a << x } assert_equal(["foo", "\nb", "ar\n", "b", "az\n"], a) + bug6054 = '[ruby-dev:45267]' + e = assert_raise(IOError, bug6054) {IO.foreach(t.path, mode:"w").next} + assert_match(/not opened for reading/, e.message, bug6054) end def test_s_readlines |