1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test
adamroyjones c70dc3cafb [ruby/csv] Add handling for ambiguous parsing options (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
2021-12-24 14:35:33 +09:00
..
-ext- Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
base64
benchmark
bigdecimal [ruby/bigdecimal] Fix the result precision of BigDecimal#divmod 2021-12-24 02:29:01 +09:00
cgi [ruby/cgi] Check integer overflow in long range 2021-12-12 13:05:15 +09:00
coverage
csv [ruby/csv] Add handling for ambiguous parsing options (https://github.com/ruby/csv/pull/226) 2021-12-24 14:35:33 +09:00
date [ruby/date] check_limit: also handle symbols 2021-11-16 22:51:41 +09:00
did_you_mean Revert the commits for did_you_mean 2021-12-23 10:09:10 +09:00
digest
drb Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
dtrace
erb
error_highlight
etc
excludes
fiber Improve interface for get/set/copy. 2021-12-21 12:25:42 +13:00
fiddle
fileutils
fixtures/fake_sorted_set_gem
io [ruby/io-wait] Disable ractor test which is meaningless on earlier versions 2021-11-16 20:25:44 +09:00
irb [ruby/irb] Check colorize option correctly to clear char attr and don't use it for tests 2021-12-21 15:50:32 +09:00
json
lib Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
logger [ruby/logger] Removed loading old helper file and load Logger class by itself 2021-12-18 08:38:58 +09:00
mkmf
monitor
net Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
nkf
objspace
open-uri
openssl [ruby/openssl] ssl: update test_options_disable_versions 2021-12-20 23:42:04 +09:00
optparse Revert "Replace an deprecated constant with a new one in did_you_mean" 2021-12-23 10:48:27 +09:00
ostruct [ruby/ostruct] Alias less methods 2021-12-06 23:21:07 -05:00
pathname
psych
racc
rdoc [ruby/rdoc] Support addition Object class when adding methods to top level 2021-12-09 18:16:06 +09:00
readline test/readline/test_readline.rb: skip a test on i686-linux 2021-11-09 14:52:48 +09:00
reline [ruby/reline] Add encoding info to an assertion of editing line 2021-12-24 11:03:34 +09:00
resolv
rinda Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
ripper ripper: refine test to show expected states 2021-12-14 20:06:51 +09:00
ruby Add fiber scheduler hooks for pread/pwrite, and add support to IO::Buffer. 2021-12-23 12:20:09 +13:00
rubygems Merge RubyGems-3.3.2 and Bundler-2.3.2 2021-12-24 10:35:31 +09:00
socket Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
stringio
strscan
syslog
uri
win32ole [ruby/win32ole] Scale timeout in win32ole 2021-11-25 23:53:15 +09:00
yaml
zlib [ruby/zlib] [Bug #18358] Fix crash in zlib when in progress 2021-11-24 23:01:41 +09:00
runner.rb Disable experimental warnings in test/runner.rb 2021-11-10 17:42:09 +09:00
test_abbrev.rb
test_delegate.rb
test_extlibs.rb
test_find.rb
test_forwardable.rb
test_getoptlong.rb [ruby/getoptlong] fixup 5f57f47572502173e2e8880f83ef7b3e2659f974 2021-11-11 14:00:32 +09:00
test_ipaddr.rb
test_mutex_m.rb
test_observer.rb
test_open3.rb [ruby/open3] Use RbConfig's 'host_os' 2021-12-09 19:28:54 +09:00
test_pp.rb [ruby/pp] Add context to bind_call and skip 2.7+ test 2021-12-18 08:38:59 +09:00
test_prettyprint.rb
test_pstore.rb
test_pty.rb
test_rbconfig.rb
test_securerandom.rb [ruby/securerandom] Split Random::Formatter from SecureRandom [Feature #18190] 2021-12-09 20:26:44 +09:00
test_set.rb
test_shellwords.rb
test_singleton.rb
test_sorted_set.rb
test_syslog.rb
test_tempfile.rb
test_time.rb
test_timeout.rb
test_tmpdir.rb
test_trick.rb
test_tsort.rb
test_unicode_normalize.rb
test_weakref.rb