Actions
Patch #28112
closedCsvTest fails due to a regression in Ruby 2.5
Start date:
Due date:
% Done:
0%
Estimated time:
Description
Ruby 2.5.0 at r17185 don't pass csv_test.rb:29.
Failure: CsvTest#test_should_include_bom_when_utf8_encoded [/Users/sho-h/local/src/redmine/redmine.sho-h/test/unit/lib/redmine/export/csv_test.rb:29]: Expected false to be truthy.
Maybe, the reason is regression in 2.5.0.
$ cat csvtest.rb require 'csv' bom = "\xEF\xBB\xBF" res1_1 = bom.dup res1_2 = CSV.generate(res1_1, encoding: "UTF-8") {|csv| csv << %w(Foo Bar)} p [bom, res1_1, res1_2] res2_1 = "aa,bb" res2_2 = CSV.generate(res2_1, encoding: "UTF-8") {|csv| csv << %w(Foo Bar)} p [bom, res2_1, res2_2] $ rbenv each ruby -v csvtest.rb | more ... ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-darwin15] ["<U+FEFF>", "<U+FEFF>Foo,Bar\n", "<U+FEFF>Foo,Bar\n"] ["<U+FEFF>", "aa,bbFoo,Bar\n", "aa,bbFoo,Bar\n"] ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin15] ["<U+FEFF>", "<U+FEFF>Foo,Bar\n", "<U+FEFF>Foo,Bar\n"] ["<U+FEFF>", "aa,bbFoo,Bar\n", "aa,bbFoo,Bar\n"] ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin15] ["<U+FEFF>", "Foo,Bar\n", "Foo,Bar\n"] ["<U+FEFF>", "Foo,Bar\n", "Foo,Bar\n"]
This problem was already reported below.
I attach patch to fix this problem. This patch don't use CSV.generate's first argument.
Files
Related issues
Updated by Go MAEDA over 6 years ago
- Blocks Feature #27849: Ruby 2.5 support added
Updated by Go MAEDA over 6 years ago
Sho HASHIMOTO wrote:
Above problem fixed by csv gem 1.0.1.
Thank you for looking into this issue. Do you think we can fix this issue by changing Gemfile as follows?
Index: Gemfile
===================================================================
--- Gemfile (revision 17236)
+++ Gemfile (working copy)
@@ -13,6 +13,7 @@
gem "roadie", "~> 3.2.1"
gem "mimemagic"
gem "mail", "~> 2.6.4"
+gem "csv", "~> 1.0.1" if RUBY_VERSION >= "2.5"
gem "nokogiri", "~> 1.8.0"
gem "i18n", "~> 0.7.0"
Updated by Sho HASHIMOTO over 6 years ago
Thank you for looking into this issue. Do you think we can fix this issue by changing Gemfile as follows?
I think so. My patch is not needed any more. :)
I checked unit test only appending below line to Gemfile.local. My Ruby was 2.5.0.
gem 'csv', '1.0.1'
Updated by Go MAEDA over 6 years ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
Committed the fix. Thank you for working on this issue.
Updated by Go MAEDA over 6 years ago
- Related to Defect #28689: csv 1.0.2 gem breaks ImportsControllerTest added
Updated by Go MAEDA over 5 years ago
- Subject changed from Ruby 2.5.0 don't pass csv_test.rb to CsvTest fails due to a regression in Ruby 2.5
Actions