summaryrefslogtreecommitdiff
path: root/test/webrick/utils.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-08 15:38:33 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-08 15:38:33 +0000
commit742bbbb01b310440a7672fabddd016226d20bee7 (patch)
tree735522e7c5325517e91b5bbb3932d1596a4ec2b7 /test/webrick/utils.rb
parent8222432c9db1432995538a5d355d014c6fd1a0e9 (diff)
* test/webrick: Examine log and use assert_join_threads.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/utils.rb')
-rw-r--r--test/webrick/utils.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/test/webrick/utils.rb b/test/webrick/utils.rb
index f1b24cc..667ae73 100644
--- a/test/webrick/utils.rb
+++ b/test/webrick/utils.rb
@@ -26,6 +26,9 @@ module TestWEBrick
RubyBin << " \"-I#{File.dirname(EnvUtil.rubybin)}/.ext/common\""
RubyBin << " \"-I#{File.dirname(EnvUtil.rubybin)}/.ext/#{RUBY_PLATFORM}\""
+ include Test::Unit::Assertions
+ extend Test::Unit::Assertions
+
module_function
def start_server(klass, config={}, &block)
@@ -41,15 +44,16 @@ module TestWEBrick
:Logger => WEBrick::Log.new(logger),
:AccessLog => [[logger, ""]]
}.update(config))
- begin
- server_thread = server.start
- addr = server.listeners[0].addr
- block.yield([server, addr[3], addr[1], log])
- ensure
- server.shutdown
-
- server_thread.join
- end
+ server_thread = server.start
+ addr = server.listeners[0].addr
+ client_thread = Thread.new {
+ begin
+ block.yield([server, addr[3], addr[1], log])
+ ensure
+ server.shutdown
+ end
+ }
+ assert_join_threads([client_thread, server_thread])
log_string
end