mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/csv.rb: A fix for row comparison by Stephen Wattam. [Bug #7528]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0dc6b83935
commit
5b1065f3fe
3 changed files with 27 additions and 18 deletions
|
@ -1,3 +1,7 @@
|
|||
Tue Dec 08 02:39:23 2012 James Edward Gray II <james@graysoftinc.com>
|
||||
|
||||
* lib/csv.rb: A fix for row comparison by Stephen Wattam. [Bug #7528]
|
||||
|
||||
Sat Dec 8 01:27:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* lib/test/unit.rb (Test::Unit::Runner#_run_parallel): no need to
|
||||
|
|
|
@ -475,7 +475,8 @@ class CSV
|
|||
# same order as +other+.
|
||||
#
|
||||
def ==(other)
|
||||
@row == other.row
|
||||
return @row == other.row if other.is_a? CSV::Row
|
||||
@row == other
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -256,7 +256,7 @@ class TestCSV::Row < TestCSV
|
|||
assert_equal( [["A", 1], ["A", 4], ["A", nil]],
|
||||
@row.select { |pair| pair.first == "A" } )
|
||||
|
||||
assert_equal(10, @row.inject(0) { |sum, (header, n)| sum + (n || 0) })
|
||||
assert_equal(10, @row.inject(0) { |sum, (_, n)| sum + (n || 0) })
|
||||
end
|
||||
|
||||
def test_to_a
|
||||
|
@ -310,4 +310,8 @@ class TestCSV::Row < TestCSV
|
|||
"Header field pair not found." )
|
||||
end
|
||||
end
|
||||
|
||||
def test_can_be_compared_with_other_classes
|
||||
assert(CSV::Row.new([ ], [ ]) != nil, "The row was nil")
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue