diff --git a/node.cc b/node.cc index 2eb189c390..e458775f0d 100644 --- a/node.cc +++ b/node.cc @@ -154,7 +154,7 @@ main (int argc, char *argv[]) g->Set( String::New("log"), FunctionTemplate::New(LogCallback)->GetFunction()); Init_timer(g); - Init_tcp(g); + //Init_tcp(g); Init_http(g); V8::SetFatalErrorHandler(OnFatalError); diff --git a/test/common.rb b/test/common.rb index 484b7bddd5..44f1ee64ce 100644 --- a/test/common.rb +++ b/test/common.rb @@ -11,7 +11,11 @@ def assert(x, msg = "") end def assert_equal(x, y, msg = "") - assert(x == y, "#{x.inspect} != #{y.inspect} #{msg}") + raise("expected #{x.inspect} == #{y.inspect}. #{msg}") unless x == y +end + +def assert_less_than(x, y, msg = "") + raise("expected #{x.inspect} < #{y.inspect}. #{msg}") unless x < y end def wait_for_server(host, port) diff --git a/test/test_setTimeout.rb b/test/test_setTimeout.rb new file mode 100755 index 0000000000..7a0b0f08ea --- /dev/null +++ b/test/test_setTimeout.rb @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +require File.dirname(__FILE__) + "/common" + +prog = IO.popen("#{$node} #{$tf.path}") +a = Time.now +assert_equal("hello\n", prog.readpartial(100)) +b = Time.now +assert_equal("world\n", prog.read(100)) +c = Time.now + +assert_less_than(b - a, 0.5) # startup time +assert_less_than(1.5, c - b) + +__END__ +log("hello"); +setTimeout(function () { log("world"); }, 1500);