Browse Source

add test/test_clearTimeout.rb

v0.7.4-release
Ryan 16 years ago
parent
commit
ab248e8422
  1. 1
      test/common.rb
  2. 14
      test/test_clearTimeout.rb
  3. 1
      test/test_http_server_echo.rb

1
test/common.rb

@ -1,4 +1,3 @@
require 'net/http'
require 'tempfile' require 'tempfile'
$node = File.join(File.dirname(__FILE__), "../node") $node = File.join(File.dirname(__FILE__), "../node")

14
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)

1
test/test_http_server_echo.rb

@ -1,4 +1,5 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'net/http'
require File.dirname(__FILE__) + "/common" require File.dirname(__FILE__) + "/common"
pid = fork do pid = fork do

Loading…
Cancel
Save