mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/csv.rb: Enhance each() to support Enumerator.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b74f5dee4a
commit
a9c056f1ed
3 changed files with 20 additions and 4 deletions
|
@ -112,6 +112,14 @@ class TestCSV::Interface < TestCSV
|
|||
assert_equal(nil, csv.shift)
|
||||
end
|
||||
end
|
||||
|
||||
def test_enumerators_are_supported
|
||||
CSV.open(@path, col_sep: "\t", row_sep: "\r\n") do |csv|
|
||||
enum = csv.each
|
||||
assert_instance_of(Enumerator, enum)
|
||||
assert_equal(@expected.shift, enum.next)
|
||||
end
|
||||
end
|
||||
|
||||
### Test Write Interface ###
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue