Граф коммитов

145 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA bcf01b18cf Reapply the following commits related to extend timeout value.
66d1900423
  0686e4181d
  1a63468831
  e1fee7f949
  232e43fd52
2022-12-09 16:36:22 +09:00
Hiroshi SHIBATA 643918ecfe Merge csv-3.2.6 2022-12-09 16:36:22 +09:00
Takashi Kokubun 232e43fd52 Respect RUBY_TESTOPTS on test-all (https://github.com/Shopify/ruby/pull/435)
* Respect RUBY_TESTOPTS on test-all

* Increase the Cirrus timeout

* Increase the CSV test timeout
2022-08-29 09:09:41 -07:00
Sutou Kouhei 1a1550ba5d [ruby/csv] test: reduce size for stability on GitHub Actions
https://github.com/ruby/csv/commit/68461aead5
2021-12-24 14:35:33 +09:00
Sutou Kouhei 22ef4f6445 [ruby/csv] Revert "parser: fix a keep bug that some texts may be dropped unexpectedly"
This reverts commit https://github.com/ruby/csv/commit/5c6523da0a61.

This introduces another pbolem. We should try again later.

https://github.com/ruby/csv/commit/43a1d6fff1
2021-12-24 14:35:33 +09:00
Sutou Kouhei 4a5d372ca8 [ruby/csv] parser: fix a keep bug that some texts may be dropped unexpectedly
Ruby: [Bug #18245] [ruby-core:105587]

Reported by Hassan Abdul Rehman.

https://github.com/ruby/csv/commit/5c6523da0a
2021-12-24 14:35:33 +09:00
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
Nobuyoshi Nakada 47c53af168 [ruby/csv] Fix typos [ci skip] (https://github.com/ruby/csv/pull/224)
https://github.com/ruby/csv/commit/27c0b66c8f
2021-12-24 14:35:33 +09:00
Takashi Kokubun 1a63468831
Prepare for removing RubyVM::JIT (#5262) 2021-12-13 23:07:46 -08:00
rm155 ee948fc1b4 [ruby/csv] Add support for Ractor (https://github.com/ruby/csv/pull/218)
https://github.com/ruby/csv/commit/a802690e11
2021-10-24 05:57:33 +09:00
Anthony Hernandez 8fde54a3b5 [ruby/csv] CSV(): Add support for Ruby 3 (https://github.com/ruby/csv/pull/215)
The implementation of the `CSV` shortcut method is broken in Ruby 3
for calls that look like this:

```ruby
CSV(write_stream, col_sep: "|", headers: headers, write_headers: true) do |csv|
  ...
end
```

The above will result in the following error when the `CSV` method attempts to pass
on arguments to `CSV#instance`:

```
ArgumentError: wrong number of arguments (given 2, expected 0..1)
```

The issue is due to the changes in Ruby 3 relating to positional & keyword arguments.

This commit updates the `CSV()` shortcut implementation to work with Ruby 3, and also
updates the documentation for the shortcut method.

https://github.com/ruby/csv/commit/310dee45fa
2021-10-24 05:57:33 +09:00
Joakim Antman 7f3dd601c8 [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
2021-10-24 05:57:33 +09:00
Takashi Kokubun e1fee7f949
Rename RubyVM::MJIT to RubyVM::JIT
because the name "MJIT" is an internal code name, it's inconsistent with
--jit while they are related to each other, and I want to discourage future
JIT implementation-specific (e.g. MJIT-specific) APIs by this rename.

[Feature #17490]
2021-01-13 22:46:51 -08:00
Sutou Kouhei 832b7f3c54 [ruby/csv] Add support for \r\n with skip_lines: /...$/ again
GitHub: fix GH-194

Reported by Josef Šimánek. Thanks!!!

https://github.com/ruby/csv/commit/fd86afe081
2020-11-24 09:33:55 +09:00
Burdette Lamar 614afb1647 [ruby/csv] Fix CSV.filter to preserve headers (#174)
Co-authored-by: Sutou Kouhei <kou@clear-code.com>

https://github.com/ruby/csv/commit/203c5e0574
2020-11-24 09:33:55 +09:00
Sutou Kouhei 4fcfa85cb6
[ruby/csv] CSV.generate_line: use the encoding of the first non ASCII field as the expected encoding
See also: https://github.com/ruby/stringio/issues/13#issuecomment-660543554

https://github.com/ruby/csv/commit/004cf49d18
2020-07-20 02:32:55 +09:00
Sutou Kouhei 178649e6dc
[ruby/csv] force_quotes: add support for specifying the target indexes or names
GitHub: fix GH-153

Reported by Aleksandr. Thanks!!!

https://github.com/ruby/csv/commit/8812c58a26
2020-07-20 02:32:54 +09:00
Koichi ITO 08e70126ae
[ruby/csv] Add `invalid: :replace` for `CSV.open` (#130)
This PR adds `invalid: :replace` for `CSV.open`. It is a PR similar to #129.
https://github.com/ruby/csv/commit/5bf687341c
2020-07-20 02:32:52 +09:00
Koichi ITO cee10c1b70
[ruby/csv] Fix an error for `CSV.open` (#131)
Follow up to https://github.com/ruby/csv/pull/130/files#r434885191.

This PR fixes `ArgumentError` for `CSV.open` when processing
invalid byte sequence in UTF-8.
https://github.com/ruby/csv/commit/a4b528c209
2020-07-20 02:32:52 +09:00
Koichi ITO 4e33a87879
[ruby/csv] Add `undef: :replace` for `CSV.open` (#129)
This PR adds `undef: :replace` option for `CSV.open`.

`File.open` has `undef: :replace` option, but `CSV.open` does not.
It would be convenient if `CSV.open` could have a shortcut by having
`undef: :replace` option.
https://github.com/ruby/csv/commit/cff8b18480
2020-07-20 02:32:51 +09:00
Sutou Kouhei b8084b5cb4
[ruby/csv] Fix a bug that write_nil_value or write_empty_value don't work with non String
GitHub: fix GH-123

Reported by asm256. Thanks!!!

https://github.com/ruby/csv/commit/b4492139be
2020-07-20 02:32:50 +09:00
Sutou Kouhei 5359121a56
[ruby/csv] Revert "test: use binary mode explicitly for Ruby 2.7"
This reverts commit 736174d28413a4c36630b0daf2f170c8d2fc9abe.

It doesn't solve anything.

https://github.com/ruby/csv/commit/0ee3bdd0d3
2020-07-20 02:32:50 +09:00
Sutou Kouhei 0ee5578e8c
[ruby/csv] test: use binary mode explicitly for Ruby 2.7
https://github.com/ruby/csv/commit/736174d284
2020-07-20 02:32:50 +09:00
Sutou Kouhei 814bfc8adc
[ruby/csv] Fix a parse bug when split character exists in middle of column value
GitHub: fix #115

Reported by TOMITA Masahiro. Thanks!!!

https://github.com/ruby/csv/commit/398b3564c5
2020-07-20 02:32:49 +09:00
Seiei Miyagi 3c5b67e0db
[ruby/csv] Ensuring StringIO's encoding in CSV.generate (#111)
https://github.com/ruby/csv/commit/dbf55ef008
2020-07-20 02:32:49 +09:00
Mike MacDonald d57bc03ba9
[ruby/csv] Do not loop forever when skip_lines regexp matches zero length with anchors (#110)
* Do not loop forever when skip_lines regexp matches zero length with anchors

* Remove needless white spaces

* Add missing eos check in skip_needless_lines

* Simplify test

https://github.com/ruby/csv/commit/3b15d4a3e8
2020-07-20 02:32:49 +09:00
Jim Kane b219cd5ac3
[ruby/csv] Make CSV::Row#dup return a usable Row (#108)
* Make CSV::Row#dup return a usable Row

Previously, calling `dup` on a `CSV::Row` object yielded an object whose
copy was too shallow. Changing the clone's fields would also change the
fields on the source. This change makes the clone more distinct from the
source, so that changes can be made to its fields without affecting the
source.

* Simplify

https://github.com/ruby/csv/commit/64a1ea06fc
2020-07-20 02:32:49 +09:00
Sutou Kouhei 9141aae8c2
[ruby/csv] Suppress warnings
https://github.com/ruby/csv/commit/b37df55f46
2020-07-20 02:32:49 +09:00
Nobuyoshi Nakada d03a7c6a25
Revert "test/csv/write/test_general.rb: suppress warnings"
This reverts commit 375cf12918, to
sync csv from the upstream.
2020-07-20 02:32:48 +09:00
Nobuyoshi Nakada 634eeb4353
Removed trailing spaces [ci skip] 2020-05-14 19:57:39 +09:00
Nobuyoshi Nakada 0686e4181d
Fixed for older versions
Fix up 66d1900423, `RubyVM::MJIT` is
available since ruby 2.6.
2020-02-26 10:16:32 +09:00
Takashi Kokubun 66d1900423
Increase timeout for CSV test with --jit-wait
To prevent CI failures like
http://ci.rvm.jp/results/trunk-mjit-wait@silicon-docker/2739995
2020-02-25 09:27:24 -08:00
David Rodríguez f48655d04d Remove unneeded exec bits from some files
I noticed that some files in rubygems were executable, and I could think
of no reason why they should be.

In general, I think ruby files should never have the executable bit set
unless they include a shebang, so I run the following command over the
whole repo:

```bash
find . -name '*.rb' -type f -executable -exec bash -c 'grep -L "^#!" $1 || chmod -x $1' _ {} \;
```
2019-11-09 21:36:30 +09:00
Yusuke Endoh 375cf12918 test/csv/write/test_general.rb: suppress warnings
of "setting Encoding.default_internal".
2019-10-15 23:29:49 +09:00
Sutou Kouhei 92df7d98b6
Import CSV 3.1.2 (#2547) 2019-10-12 14:03:21 +09:00
Jeremy Evans 146677a1e7 Fix keyword argument warnings in the tests from Class#new
This were previously hidden because calls from C were not warned.
2019-09-06 19:41:23 -07:00
Jeremy Evans 856bb3c35d Fix remaining warning issues in the tests due to keyword argument separation 2019-08-30 12:39:31 -07:00
Jeremy Evans e0b4599bba Fix keyword argument separation warnings in test 2019-08-30 12:39:31 -07:00
Hiroshi SHIBATA b39efb163d
Aliases capture_output to capture_io for test-unit compatiblity. 2019-08-08 17:19:23 +09:00
Kouhei Sutou 198281a71d [ruby/csv] Fix a bug that strip: true removes newlines
https://github.com/ruby/csv/commit/5540d35a30
2019-07-14 23:07:31 +09:00
Kouhei Sutou 8392592a0a [ruby/csv] Don't raise on eof?
GitHub: fix #86

Reported by krororo. Thanks!!!

https://github.com/ruby/csv/commit/5a8d9d9297
2019-07-14 23:07:31 +09:00
Hiroshi SHIBATA 9f275f7971
Restore support library for only test files that are digest and csv. 2019-07-09 21:16:49 +09:00
Nobuyoshi Nakada 832b509472
with_different_ofs.rb has been moved too 2019-07-02 09:43:33 +09:00
Nobuyoshi Nakada 45ba027d08
Removed unused variables 2019-06-30 08:45:01 +09:00
kou 3791bdf080 Import CSV 3.0.9
This fixes test failures on Windows.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-04-15 02:05:03 +00:00
kou e3b6c7c7eb Import CSV 3.0.8
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
2019-04-14 21:01:51 +00:00
kou 24b57b102c Upgrade CSV to 3.0.4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-01-25 06:49:59 +00:00
nobu 71e458023d remove trailing spaces [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-23 11:11:35 +00:00
kou e5d634260e Import CSV 3.0.2
This includes performance improvement especially writing. Writing is
about 2 times faster.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-23 07:00:35 +00:00
hsbt 60ebd4e26a Merge csv-3.0.0 from ruby/csv repository.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-05 13:33:21 +00:00