diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-11-13 20:22:13 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-11-13 20:22:13 +0000 |
commit | f4af812a28b03508c96853739aea53f7a6714abf (patch) | |
tree | cbfe8ae9ae2a6c228f0176f93ff811030aade122 /test/unit/test_socket_helper.rb | |
parent | 4bd0dbdf2d27672dc941746e06b647ea26fe63ee (diff) | |
download | unicorn-f4af812a28b03508c96853739aea53f7a6714abf.tar.gz |
assert_nothing_raised ends up hiding errors and backtraces, making things harder to debug. Since Test::Unit already fails on uncaught exceptions, there is no need to assert on the lack of exceptions for a successful test run. This is a followup to commit 5acf5522295c947d3118926d1a1077007f615de9
Diffstat (limited to 'test/unit/test_socket_helper.rb')
-rw-r--r-- | test/unit/test_socket_helper.rb | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/test/unit/test_socket_helper.rb b/test/unit/test_socket_helper.rb index f099391..a38082c 100644 --- a/test/unit/test_socket_helper.rb +++ b/test/unit/test_socket_helper.rb @@ -37,16 +37,13 @@ class TestSocketHelper < Test::Unit::TestCase [ { :backlog => 5 }, { :sndbuf => 4096 }, { :rcvbuf => 4096 }, { :backlog => 16, :rcvbuf => 4096, :sndbuf => 4096 } ].each do |opts| - assert_nothing_raised do - tcp_listener = bind_listen(tcp_listener_name, opts) - assert TCPServer === tcp_listener - tcp_listener.close - unix_listener = bind_listen(unix_listener_name, opts) - assert UNIXServer === unix_listener - unix_listener.close - end + tcp_listener = bind_listen(tcp_listener_name, opts) + assert TCPServer === tcp_listener + tcp_listener.close + unix_listener = bind_listen(unix_listener_name, opts) + assert UNIXServer === unix_listener + unix_listener.close end - #system('cat', @log_tmp.path) end def test_bind_listen_unix @@ -106,10 +103,10 @@ class TestSocketHelper < Test::Unit::TestCase assert_raises(Errno::EADDRINUSE) do new_listener = bind_listen(@unix_listener_path) end - assert_nothing_raised do - File.unlink(@unix_listener_path) - new_listener = bind_listen(@unix_listener_path) - end + + File.unlink(@unix_listener_path) + new_listener = bind_listen(@unix_listener_path) + assert UNIXServer === new_listener assert new_listener.fileno != @unix_listener.fileno assert_equal sock_name(new_listener), sock_name(@unix_listener) @@ -127,10 +124,8 @@ class TestSocketHelper < Test::Unit::TestCase end def test_server_cast - assert_nothing_raised do - test_bind_listen_unix - test_bind_listen_tcp - end + test_bind_listen_unix + test_bind_listen_tcp unix_listener_socket = Socket.for_fd(@unix_listener.fileno) assert Socket === unix_listener_socket @unix_server = server_cast(unix_listener_socket) |