http_spew RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: http_spew-public@bogomips.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH 2/5] test_upload: use object_id to check matches
Date: Fri, 28 Oct 2016 20:15:00 +0000	[thread overview]
Message-ID: <20161028201503.10315-3-e@80x24.org> (raw)
In-Reply-To: <20161028201503.10315-1-e@80x24.org>

We do not define <=> for comparison, so object_id
is safer and more future-proof.
---
 test/test_upload.rb | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/test/test_upload.rb b/test/test_upload.rb
index 33c494a..df54765 100644
--- a/test/test_upload.rb
+++ b/test/test_upload.rb
@@ -117,13 +117,16 @@ class TestUpload < Test::Unit::TestCase
     req << HTTP_Spew::Request.new(@env, StringIO.new(str), @sockaddr)
     req << HTTP_Spew::Request.new(@env, StringIO.new(str), @sockaddr)
     req << HTTP_Spew::Request.new(@env, StringIO.new(str), @sockaddr)
-    before = req.dup
+    before = req.map(&:object_id)
     rv = HTTP_Spew.wait_nonblock!(3, req)
     while rv.nil? do
       rv = HTTP_Spew.wait_nonblock!(3, req)
     end
     assert_nil rv.uniq!
     assert rv.size > 0
-    rv.each { |r| assert before.include?(r) }
+    rv.map!(&:object_id)
+    rv.each do |r|
+      assert before.include?(r), "rv=#{rv.inspect} before=#{before.inspect}"
+    end
   end
 end if HAVE_UNICORN
-- 
EW


  parent reply	other threads:[~2016-10-28 20:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28 20:14 [PATCH 0/5] random half-brained updates Eric Wong
2016-10-28 20:14 ` [PATCH 1/5] declare empty classes with constant assignment Eric Wong
2016-10-28 20:15 ` Eric Wong [this message]
2016-10-28 20:15 ` [PATCH 3/5] use frozen string literals for Ruby 2.1+ Eric Wong
2016-10-28 20:15 ` [PATCH 4/5] merge into kcar project and mailing list Eric Wong
2016-10-28 20:15 ` [PATCH 5/5] dedicated " Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/http_spew/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161028201503.10315-3-e@80x24.org \
    --to=e@80x24.org \
    --cc=http_spew-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/http_spew.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox