From: Ryan Date: Wed, 4 Mar 2009 11:04:04 +0000 (+0100) Subject: add test/test_clearTimeout.rb X-Git-Tag: v0.0.1~188 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab248e8422b37c34cff90dba12bef8185386ed26;p=platform%2Fupstream%2Fnodejs.git add test/test_clearTimeout.rb --- diff --git a/test/common.rb b/test/common.rb index 44f1ee6..9475962 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 0000000..ed839ab --- /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 7b5f8d4..55c97cf 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