From ab248e8422b37c34cff90dba12bef8185386ed26 Mon Sep 17 00:00:00 2001 From: Ryan Date: Wed, 4 Mar 2009 12:04:04 +0100 Subject: [PATCH] add test/test_clearTimeout.rb --- test/common.rb | 1 - test/test_clearTimeout.rb | 14 ++++++++++++++ test/test_http_server_echo.rb | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100755 test/test_clearTimeout.rb 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