summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-22 13:04:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-22 13:04:38 +0000
commit35bf8099d4dc06437e816815ad38309e68628d26 (patch)
tree0d46521c5295ea054311e1b16670da8983ff9115 /test
parentfa1a2ae15852ff5f3826a6173effe4d624ab8d72 (diff)
merge revision(s) 34735,34736:
* io.c (rb_io_s_foreach): return enumerator including kerword arguments. [ruby-dev:45267][Bug #6054] * io.c (rb_io_s_foreach): argument check before making Enumerator. [ruby-dev:31525] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@34749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 0fb28071cc..bb6f239509 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1555,6 +1555,16 @@ End
IO.foreach(t.path, "b", 3) {|x| a << x }
assert_equal(["foo", "\nb", "ar\n", "b", "az\n"], a)
+ bug = '[ruby-dev:31525]'
+ assert_raise(ArgumentError, bug) {IO.foreach}
+
+ a = nil
+ assert_nothing_raised(ArgumentError, bug) {a = IO.foreach(t.path).to_a}
+ assert_equal(["foo\n", "bar\n", "baz\n"], a, bug)
+
+ 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