From 5b1065f3fee2a3cb0095a28a5bedaa3f74f09a5b Mon Sep 17 00:00:00 2001 From: jeg2 Date: Fri, 7 Dec 2012 17:42:16 +0000 Subject: * 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 --- ChangeLog | 36 ++++++++++++++++++++---------------- lib/csv.rb | 3 ++- test/csv/test_row.rb | 6 +++++- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index b313c06ad0..7eefd82515 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Dec 08 02:39:23 2012 James Edward Gray II + + * lib/csv.rb: A fix for row comparison by Stephen Wattam. [Bug #7528] + Sat Dec 8 01:27:23 2012 Nobuyoshi Nakada * lib/test/unit.rb (Test::Unit::Runner#_run_parallel): no need to @@ -1308,7 +1312,7 @@ Thu Nov 29 15:10:45 2012 NARUSE, Yui * test/minitest/test_minitest_unit.rb: restore orig_verbose only if it is set. This broke rdoc's tests. - http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121129T050102Z.diff.html.gz + http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20121129T050102Z.diff.html.gz Thu Nov 29 14:56:30 2012 Koichi Sasada @@ -5370,7 +5374,7 @@ Fri Sep 28 17:26:27 2012 NARUSE, Yui fails on Windows with msys bash. It makes comparing paths case-insensitive. pick from upstream to fix a failure of test-all [ruby-core:47711] - https://github.com/rubygems/rubygems/commit/c474edb2f3704206f04da1c8c6cf9fb079d84abe + https://github.com/rubygems/rubygems/commit/c474edb2f3704206f04da1c8c6cf9fb079d84abe Fri Sep 28 15:44:45 2012 Shugo Maeda @@ -7248,7 +7252,7 @@ Sun Jul 22 23:58:48 2012 NARUSE, Yui Sat Jul 21 06:21:45 2012 NARUSE, Yui * lib/net/http.rb: fixes for r36476. [Feature #6546] - http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120720T030101Z.diff.html.gz + http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120720T030101Z.diff.html.gz * lib/net/http.rb (Net::HTTP.newobj): return back for compatibility. @@ -8900,7 +8904,7 @@ Wed Jun 13 10:20:27 2012 Nobuyoshi Nakada * process.c (rb_exec_fillarg): use shell if the first word is reserved or special built-in name. - http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html + http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html * process.c (rb_exec_fillarg): treat '=' only in the first word. if the first word does not contain '=', it is the command name and @@ -9053,7 +9057,7 @@ Mon Jun 11 06:17:06 2012 NARUSE, Yui * thread_pthread.c (native_cond_initialize): fix typo in r36022. this cause a failure on FreeBSD 8.2 amd64. - http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20120610T130201Z.diff.html.gz + http://fbsd.rubyci.org/~chkbuild/ruby-trunk/log/20120610T130201Z.diff.html.gz Mon Jun 11 05:21:57 2012 Koichi Sasada @@ -9132,7 +9136,7 @@ Sun Jun 10 15:49:47 2012 Tanaka Akira Sun Jun 10 14:19:33 2012 NARUSE, Yui * configure.in: NetBSD 6 adds libexecinfo but it only works on amd64. - http://www.mail-archive.com/source-changes-full@netbsd.org/msg38729.html + http://www.mail-archive.com/source-changes-full@netbsd.org/msg38729.html Sun Jun 10 12:43:23 2012 Tanaka Akira @@ -10825,7 +10829,7 @@ Tue May 8 07:44:18 2012 NARUSE, Yui * ext/openssl/ossl_ssl.c (ossl_start_ssl): remove useless rb_sys_fail before ossl_raise. this cause a test failure on Linux. - http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120507T190102Z.log.html.gz + http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20120507T190102Z.log.html.gz Tue May 8 05:35:18 2012 Eric Hodel @@ -10860,13 +10864,13 @@ Tue May 8 02:34:26 2012 NARUSE, Yui * lib/minitest/unit.rb (assert_match): refix of r35563. r35563 breaks the intention of the original change. - https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3 + https://github.com/seattlerb/minitest/commit/68858105b2eb11c85105ffac5f32b662c59397f3 * lib/minitest/unit.rb (refute_match): ditto. Mon May 7 21:19:17 2012 NARUSE, Yui * ext/json: Merge JSON 1.7.1. - https://github.com/flori/json/commit/e5b9a9465c1159fae533bca320d950b772bcb4ac + https://github.com/flori/json/commit/e5b9a9465c1159fae533bca320d950b772bcb4ac Mon May 7 22:54:22 2012 Martin Bosslet @@ -11158,7 +11162,7 @@ Fri Apr 27 07:15:07 2012 Tanaka Akira * ext/socket/socket.c (sock_s_pack_sockaddr_un): support the longest path in sockaddr_un, really. reported by nagachika. - http://d.hatena.ne.jp/nagachika/20120426/ruby_trunk_changes_35474_35476 + http://d.hatena.ne.jp/nagachika/20120426/ruby_trunk_changes_35474_35476 Thu Apr 26 12:28:06 2012 Tanaka Akira @@ -11323,7 +11327,7 @@ Mon Apr 23 20:11:02 2012 Tanaka Akira * lib/drb/ssl.rb: generate 1024 bits RSA key instead of 512 bits. OpenSSL 1.0.1 rejects 512 bits RSA key for TLS1.2 with SHA512. - http://rt.openssl.org/Ticket/Display.html?id=2769&user=guest&pass=guest + http://rt.openssl.org/Ticket/Display.html?id=2769&user=guest&pass=guest reported by Bohuslav Kabrda. [ruby-core:43844] [ruby-trunk - Bug #6221] @@ -11803,7 +11807,7 @@ Sun Apr 8 22:46:01 2012 NARUSE, Yui * ext/json/generator/generator.c (generate_json_bignum): add RB_GC_GUARD. - http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20120407T210301Z.diff.html.gz + http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20120407T210301Z.diff.html.gz Sun Apr 8 07:26:40 2012 NARUSE, Yui @@ -18546,7 +18550,7 @@ Wed Aug 31 17:28:23 2011 Hiroshi Nakamura * variable.c (rb_autoload_load): Move RB_GC_GUARD() to proper position based on suggestion by CHIKANAGA Tomoyuki at - http://d.hatena.ne.jp/nagachika/20110826/ruby_trunk_changes_33070_33078 + http://d.hatena.ne.jp/nagachika/20110826/ruby_trunk_changes_33070_33078 * variable.c (autoload_defined_p): Fix incompatible autoload behavior that causes Rails crash. Class definition instruction defined in @@ -18749,8 +18753,8 @@ Sat Aug 27 11:18:12 2011 Hiroshi Nakamura * Revert r33078. It caused a Rails application NoMethodError. - /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/utils.rb:157: warning: toplevel constant ScanError referenced by Regin::Parser::ScanError - /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/vendor/regin/regin/parser.rb:17:in `parse_regexp': undefined method `scan_str' for # (NoMethodError) + /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/utils.rb:157: warning: toplevel constant ScanError referenced by Regin::Parser::ScanError + /home/nahi/git/emptyApp/ruby/1.9.1/gems/rack-mount-0.6.14/lib/rack/mount/vendor/regin/regin/parser.rb:17:in `parse_regexp': undefined method `scan_str' for # (NoMethodError) Sat Aug 27 08:44:58 2011 Eric Hodel @@ -19344,7 +19348,7 @@ Sun Aug 7 00:42:55 2011 NARUSE, Yui * ext/tk/lib/tk/wm.rb (Tk::Wm.command): Add the missing receiver before calling epath. patched by flori - https://github.com/flori/ruby/commit/aa9474d32e5f2c57f8b0e2e0c528a03f06a4d433 + https://github.com/flori/ruby/commit/aa9474d32e5f2c57f8b0e2e0c528a03f06a4d433 Sat Aug 6 07:06:34 2011 Eric Hodel diff --git a/lib/csv.rb b/lib/csv.rb index 58953a2bf9..a0209223c2 100644 --- a/lib/csv.rb +++ b/lib/csv.rb @@ -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 # diff --git a/test/csv/test_row.rb b/test/csv/test_row.rb index 345b7a2342..3016c5b57c 100755 --- a/test/csv/test_row.rb +++ b/test/csv/test_row.rb @@ -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 -- cgit v1.2.3