summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authorJoakim Antman <antmanj@gmail.com>2021-10-03 22:10:48 +0300
committerSutou Kouhei <kou@cozmixng.org>2021-10-24 05:57:33 +0900
commit7f3dd601c895354c041988251a0be05a8a423664 (patch)
treebfe09f2aa1818fc07aeeb54c24aa55078865d47c /test/csv
parent39ecdabe67d1bc7c864ada6f282590dbc9d3a14e (diff)
[ruby/csv] Changed line ending handling to consider the combination \r\n as a single entry when row is faulty (https://github.com/ruby/csv/pull/220)
https://github.com/ruby/csv/commit/29cef9ea9d
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5010
Diffstat (limited to 'test/csv')
-rw-r--r--test/csv/parse/test_invalid.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/csv/parse/test_invalid.rb b/test/csv/parse/test_invalid.rb
index 9dfd081380..ddb59e2b9a 100644
--- a/test/csv/parse/test_invalid.rb
+++ b/test/csv/parse/test_invalid.rb
@@ -36,4 +36,17 @@ ggg,hhh,iii
csv.shift)
assert_equal(true, csv.eof?)
end
+
+ def test_ignore_invalid_line_cr_lf
+ data = <<-CSV
+"1","OK"\r
+"2",""NOT" OK"\r
+"3","OK"\r
+CSV
+ csv = CSV.new(data)
+
+ assert_equal(['1', 'OK'], csv.shift)
+ assert_raise(CSV::MalformedCSVError) { csv.shift }
+ assert_equal(['3', 'OK'], csv.shift)
+ end
end