diff --git a/test/common.rb b/test/common.rb index 44f1ee64ce..94759627aa 100644 --- a/test/common.rb +++ b/test/common.rb @@ -1,4 +1,3 @@ -require 'net/http' require 'tempfile' $node = File.join(File.dirname(__FILE__), "../node") diff --git a/test/test_clearTimeout.rb b/test/test_clearTimeout.rb new file mode 100755 index 0000000000..ed839abb02 --- /dev/null +++ b/test/test_clearTimeout.rb @@ -0,0 +1,14 @@ +#!/usr/bin/env ruby +require File.dirname(__FILE__) + "/common" + +a = Time.now +out = `#{$node} #{$tf.path}` +b = Time.now +assert_equal("hello\nworld\n", out) +assert_less_than(b - a, 1) # startup time + +__END__ +log("hello"); +timeout1 = setTimeout(function () { log("world"); }, 500); +timeout2 = setTimeout(function () { log("ryah"); }, 5000); +clearTimeout(timeout2) diff --git a/test/test_http_server_echo.rb b/test/test_http_server_echo.rb index 7b5f8d476a..55c97cfba7 100755 --- a/test/test_http_server_echo.rb +++ b/test/test_http_server_echo.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +require 'net/http' require File.dirname(__FILE__) + "/common" pid = fork do