diff options
Diffstat (limited to 'test/webrick/test_server.rb')
-rw-r--r-- | test/webrick/test_server.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/webrick/test_server.rb b/test/webrick/test_server.rb index ce5ee85c6c..4c064fdb4b 100644 --- a/test/webrick/test_server.rb +++ b/test/webrick/test_server.rb @@ -13,12 +13,12 @@ class TestWEBrickServer < Test::Unit::TestCase end def test_server - TestWEBrick.start_server(Echo){|server, addr, port| + TestWEBrick.start_server(Echo){|server, addr, port, log| TCPSocket.open(addr, port){|sock| - sock.puts("foo"); assert_equal("foo\n", sock.gets) - sock.puts("bar"); assert_equal("bar\n", sock.gets) - sock.puts("baz"); assert_equal("baz\n", sock.gets) - sock.puts("qux"); assert_equal("qux\n", sock.gets) + sock.puts("foo"); assert_equal("foo\n", sock.gets, log.call) + sock.puts("bar"); assert_equal("bar\n", sock.gets, log.call) + sock.puts("baz"); assert_equal("baz\n", sock.gets, log.call) + sock.puts("qux"); assert_equal("qux\n", sock.gets, log.call) } } end @@ -30,15 +30,15 @@ class TestWEBrickServer < Test::Unit::TestCase :StartCallback => Proc.new{ started += 1 }, :StopCallback => Proc.new{ stopped += 1 }, } - TestWEBrick.start_server(Echo, config){|server, addr, port| + TestWEBrick.start_server(Echo, config){|server, addr, port, log| true while server.status != :Running - assert_equal(started, 1) - assert_equal(stopped, 0) - assert_equal(accepted, 0) + assert_equal(started, 1, log.call) + assert_equal(stopped, 0, log.call) + assert_equal(accepted, 0, log.call) TCPSocket.open(addr, port){|sock| (sock << "foo\n").gets } TCPSocket.open(addr, port){|sock| (sock << "foo\n").gets } TCPSocket.open(addr, port){|sock| (sock << "foo\n").gets } - assert_equal(accepted, 3) + assert_equal(accepted, 3, log.call) } assert_equal(started, 1) assert_equal(stopped, 1) |