Project

General

Profile

Actions

Patch #28112

closed

CsvTest fails due to a regression in Ruby 2.5

Added by Sho HASHIMOTO almost 7 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Ruby support
Target version:
-
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

redmine_with_ruby250.patch (954 Bytes) redmine_with_ruby250.patch Sho HASHIMOTO, 2018-01-31 12:08

Related issues

Related to Redmine - Defect #28689: csv 1.0.2 gem breaks ImportsControllerTest Closed

Actions
Blocks Redmine - Feature #27849: Ruby 2.5 supportClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF