mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
525 B
29 lines
525 B
require 'net/http'
|
|
require 'tempfile'
|
|
|
|
$node = File.join(File.dirname(__FILE__), "../node")
|
|
$tf = Tempfile.open("node")
|
|
$tf.puts(DATA.read)
|
|
$tf.close
|
|
|
|
def assert(x, msg = "")
|
|
raise(msg) unless x
|
|
end
|
|
|
|
def assert_equal(x, y, msg = "")
|
|
assert(x == y, "#{x.inspect} != #{y.inspect} #{msg}")
|
|
end
|
|
|
|
def wait_for_server(host, port)
|
|
loop do
|
|
begin
|
|
socket = ::TCPSocket.open(host, port)
|
|
return
|
|
rescue Errno::ECONNREFUSED
|
|
$stderr.print "." if $DEBUG
|
|
$stderr.flush
|
|
sleep 0.2
|
|
end
|
|
end
|
|
end
|
|
|
|
|