mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
Fixed equality method fails when given the object that doesn't support table method.
[Bug #12422][ruby-core:75707] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9c38a08f28
commit
20aed4495b
2 changed files with 5 additions and 1 deletions
|
@ -870,7 +870,8 @@ class CSV
|
||||||
|
|
||||||
# Returns +true+ if all rows of this table ==() +other+'s rows.
|
# Returns +true+ if all rows of this table ==() +other+'s rows.
|
||||||
def ==(other)
|
def ==(other)
|
||||||
@table == other.table
|
return @table == other.table if other.is_a? CSV::Table
|
||||||
|
@table == other
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -374,4 +374,7 @@ class TestCSV::Features < TestCSV
|
||||||
assert_equal [["line", "1", "a"], ["line", "2", "b"]], c.each.to_a
|
assert_equal [["line", "1", "a"], ["line", "2", "b"]], c.each.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_table_nil_equality
|
||||||
|
assert_nothing_raised(NoMethodError) { CSV.parse("test", headers: true) == nil }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue