summaryrefslogtreecommitdiff
path: root/test/csv/parse/test_strip.rb
AgeCommit message (Collapse)Author
2024-01-22Extract csvHiroshi SHIBATA
2021-12-24[ruby/csv] Add handling for ambiguous parsing options ↵adamroyjones
(https://github.com/ruby/csv/pull/226) GitHub: fix GH-225 With Ruby 3.0.2 and csv 3.2.1, the file ```ruby require "csv" File.open("example.tsv", "w") { |f| f.puts("foo\t\tbar") } CSV.read("example.tsv", col_sep: "\t", strip: true) ``` produces the error ``` lib/csv/parser.rb:935:in `parse_quotable_robust': TODO: Meaningful message in line 1. (CSV::MalformedCSVError) ``` However, the CSV in this example is not malformed; instead, ambiguous options were provided to the parser. It is not obvious (to me) whether the string should be parsed as - `["foo\t\tbar"]`, - `["foo", "bar"]`, - `["foo", "", "bar"]`, or - `["foo", nil, "bar"]`. This commit adds code that raises an exception when this situation is encountered. Specifically, it checks if the column separator either ends with or starts with the characters that would be stripped away. This commit also adds unit tests and updates the documentation. https://github.com/ruby/csv/commit/cc317dd42d Notes: Merged: https://github.com/ruby/ruby/pull/5336
2020-07-20[ruby/csv] Fix a parse bug when split character exists in middle of column valueSutou Kouhei
GitHub: fix #115 Reported by TOMITA Masahiro. Thanks!!! https://github.com/ruby/csv/commit/398b3564c5 Notes: Merged: https://github.com/ruby/ruby/pull/3332
2019-07-14[ruby/csv] Fix a bug that strip: true removes newlinesKouhei Sutou
https://github.com/ruby/csv/commit/5540d35a30
2019-04-14Import CSV 3.0.8kou
This includes performance improvements and backward incompatibility fixes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e