diff options
| author | Sutou Kouhei <kou@clear-code.com> | 2023-06-26 14:29:26 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-06-28 16:37:10 +0900 |
| commit | d6d60d4287f58200cc3725d19cb503be70e7d724 (patch) | |
| tree | 910c78dabb8fb1446907916db83c9ef1d89edc44 /test | |
| parent | 539559d36e1355befd39c6964f3efd9dd3af4846 (diff) | |
[ruby/csv] Fix a bug that the same line is used multiple times
GitHub: fix https://github.com/ruby/csv/pull/279
It's happen when:
* `keep_start`/`keep_{drop,back}` are nested.
(e.g.: `strip: true, skip_lines: /.../`)
* Row separator is `\r\n`.
* `InputScanner` is used. (Small input doesn't use `InputScanner`)
Reported by Gabriel Nagy. Thanks!!!
https://github.com/ruby/csv/commit/183635ab56
Diffstat (limited to 'test')
| -rw-r--r-- | test/csv/parse/test_skip_lines.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/csv/parse/test_skip_lines.rb b/test/csv/parse/test_skip_lines.rb index d231cc65c3..2fea02eb04 100644 --- a/test/csv/parse/test_skip_lines.rb +++ b/test/csv/parse/test_skip_lines.rb @@ -115,4 +115,12 @@ class TestCSVParseSkipLines < Test::Unit::TestCase CSV.parse("a,b\r\n,\r\n", :skip_lines => /^,+$/)) end + + def test_crlf_strip_no_last_crlf + assert_equal([["a"], ["b"]], + CSV.parse("a\r\nb", + row_sep: "\r\n", + skip_lines: /^ *$/, + strip: true)) + end end |
