summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-23 05:59:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-01-23 05:59:28 +0000
commit5bb125c63e3bbbe6b92c43f8e1b4017eab97721f (patch)
tree2f03970aca238eda1b68a74a82e4bd24f7bc8a04 /test/csv
parent9600fb38a98919feaf6a97b8607a153501ced08f (diff)
csv.rb: fix field_size_limit check
* lib/csv.rb (CSV#shift): the last column is an Array in extended column since r55985. [ruby-dev:49964] [Bug #13149] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_csv_parsing.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/csv/test_csv_parsing.rb b/test/csv/test_csv_parsing.rb
index ff3d65fd242..547e70e9337 100755
--- a/test/csv/test_csv_parsing.rb
+++ b/test/csv/test_csv_parsing.rb
@@ -209,6 +209,28 @@ class TestCSV::Parsing < TestCSV
field_size_limit: 2048 )
end
+ def test_field_size_limit_in_extended_column_not_exceeding
+ data = <<~DATA
+ "a","b"
+ "
+ 2
+ ",""
+ DATA
+ assert_nothing_raised(CSV::MalformedCSVError) do
+ CSV.parse(data, field_size_limit: 4)
+ end
+ end
+
+ def test_field_size_limit_in_extended_column_exceeding
+ data = <<~DATA
+ "a","b"
+ "
+ 2345
+ ",""
+ DATA
+ assert_parse_errors_out(data, field_size_limit: 5)
+ end
+
private
def assert_parse_errors_out(*args)