mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/rexml/test_sax.rb: don't use thread and sleep to avoid slow test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ede915ce25
commit
7bf12316a1
2 changed files with 17 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Sep 17 23:23:26 2010 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* test/rexml/test_sax.rb: don't use thread and sleep to avoid slow test.
|
||||
|
||||
Fri Sep 17 23:10:44 2010 Kouhei Sutou <kou@cozmixng.org>
|
||||
|
||||
* test/rexml/test_core.rb: enable.
|
||||
|
|
|
@ -221,29 +221,22 @@ class SAX2Tester < Test::Unit::TestCase
|
|||
def test_socket
|
||||
require 'socket'
|
||||
|
||||
$port = 12345
|
||||
port = 12345
|
||||
|
||||
Thread.new{
|
||||
server = TCPServer.new('127.0.0.1', $port)
|
||||
while (session = server.accept)
|
||||
session << '<foo>'
|
||||
Thread.stop
|
||||
server = TCPServer.new('127.0.0.1', port)
|
||||
socket = TCPSocket.new('127.0.0.1', port)
|
||||
|
||||
ok = false
|
||||
session = server.accept
|
||||
session << '<foo>'
|
||||
parser = REXML::Parsers::SAX2Parser.new(socket)
|
||||
Fiber.new do
|
||||
parser.listen(:start_element) do
|
||||
ok = true
|
||||
Fiber.yield
|
||||
end
|
||||
}
|
||||
sleep 1 #to be sure that server is running
|
||||
@socket = TCPSocket.new('127.0.0.1',$port)
|
||||
|
||||
ok = false
|
||||
|
||||
test = Thread.new{
|
||||
parser = REXML::Parsers::SAX2Parser.new @socket
|
||||
parser.listen( :start_element ) {
|
||||
ok = true
|
||||
}
|
||||
parser.parse
|
||||
Thread.stop
|
||||
}
|
||||
sleep 1 #to be sure that server is running
|
||||
end.resume
|
||||
assert(ok)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue