summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 06:57:00 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 06:57:00 +0000
commitffb49a7e9b8ed9cc130508ff4306dd1c0a38e6c8 (patch)
tree3d57e6a3e9350acf615437cf25d719bbf41909cd /test/csv
parentede0df3a9b38d18f46aecf70075dda688c9bd4c1 (diff)
Fixed regression to convert blank value at r45497.
[Bug #11126][ruby-core:69088] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_data_converters.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/csv/test_data_converters.rb b/test/csv/test_data_converters.rb
index e274b2b..0786ca6 100755
--- a/test/csv/test_data_converters.rb
+++ b/test/csv/test_data_converters.rb
@@ -176,6 +176,15 @@ class TestCSV::DataConverters < TestCSV
@parser.shift.fields )
end
+ def test_custom_converter_with_blank_field
+ converter = lambda { |field| field.nil? }
+ row = nil
+ assert_nothing_raised(Exception) do
+ row = CSV.parse_line('nil,', converters: converter)
+ end
+ assert_equal([false, true], row);
+ end
+
def test_shortcut_interface
assert_equal( ["Numbers", ":integer", 1, ":float", 3.015],
CSV.parse_line(@data, converters: :numeric) )