зеркало из https://github.com/github/ruby.git
* lib/csv.rb: Reject nil as data source for CSV.new, patch by @Peeja.
[Fixes GH-580] https://github.com/ruby/ruby/pull/580 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
c8660d8966
Коммит
0aa197c6f2
|
@ -1,3 +1,8 @@
|
|||
Mon May 26 01:39:02 2014 Zachary Scott <e@zzak.io>
|
||||
|
||||
* lib/csv.rb: Reject nil as data source for CSV.new, patch by @Peeja.
|
||||
[Fixes GH-580] https://github.com/ruby/ruby/pull/580
|
||||
|
||||
Mon May 26 01:07:51 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/lib/minitest/unit.rb: Show leaked threads and tempfiles
|
||||
|
|
|
@ -1484,6 +1484,10 @@ class CSV
|
|||
# so be sure to set what you want here.
|
||||
#
|
||||
def initialize(data, options = Hash.new)
|
||||
if data.nil?
|
||||
raise ArgumentError.new("Cannot parse nil as CSV")
|
||||
end
|
||||
|
||||
# build the options for this read/write
|
||||
options = DEFAULT_OPTIONS.merge(options)
|
||||
|
||||
|
|
|
@ -130,6 +130,12 @@ class TestCSV::Interface < TestCSV
|
|||
end
|
||||
end
|
||||
|
||||
def test_nil_is_not_acceptable
|
||||
assert_raise_with_message ArgumentError, "Cannot parse nil as CSV" do
|
||||
CSV.new(nil)
|
||||
end
|
||||
end
|
||||
|
||||
### Test Write Interface ###
|
||||
|
||||
def test_generate
|
||||
|
|
Загрузка…
Ссылка в новой задаче