diff --git a/test/cat.js b/test/cat.js deleted file mode 100644 index 9f6aa6182e..0000000000 --- a/test/cat.js +++ /dev/null @@ -1,8 +0,0 @@ -var filename = ARGV[2]; -File.cat(filename, function (status, content) { - if (status == 0) - puts(content); - else - puts("error"); -}); -puts("hello world"); diff --git a/test/common.rb b/test/common.rb deleted file mode 100644 index 895f2c0e2c..0000000000 --- a/test/common.rb +++ /dev/null @@ -1,34 +0,0 @@ -require 'tempfile' - -$node = File.join(File.dirname(__FILE__), "../node") -$tf = Tempfile.open("node") -$tf.puts(DATA.read) -$tf.close - -def assert(x, msg = "") - raise(msg) unless x -end - -def assert_equal(x, y, 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) - loop do - begin - socket = ::TCPSocket.open(host, port) - return - rescue Errno::ECONNREFUSED - $stderr.print "." if $DEBUG - $stderr.flush - sleep 0.2 - ensure - socket.close - end - end -end - diff --git a/test/simple.js b/test/simple.js deleted file mode 100644 index b1da2bf1fa..0000000000 --- a/test/simple.js +++ /dev/null @@ -1,24 +0,0 @@ -var f = new File; - -f.open("/tmp/world", "w+", function (status) { - if (status == 0) { - stdout.puts("file open"); - f.write("hello world\n"); - f.write("something else.\n", function () { - stdout.puts("written. "); - }); - f.read(100, function (status, buf) { - if (buf) - stdout.puts("read: >>" + buf.encodeUtf8() + "<<"); - }); - } else { - stdout.puts("file open failed: " + status.toString()); - } - - f.close(function (status) { - stdout.puts("closed: " + status.toString()); - File.rename("/tmp/world", "/tmp/hello", function (status) { - stdout.puts("rename: " + status.toString()); - }); - }); -}); diff --git a/test/stats.js b/test/stats.js deleted file mode 100644 index 157a2d029d..0000000000 --- a/test/stats.js +++ /dev/null @@ -1,15 +0,0 @@ -File.stat(ARGV[2], function (status, stats) { - if (status == 0) { - for (var i in stats) { - puts(i + " : " + stats[i]); - } - } else { - puts("error: " + File.strerror(status)); - } -}); - -File.exists(ARGV[2], function (r) { - puts("file exists: " + r); -}); - - diff --git a/test/test_clearTimeout.rb b/test/test_clearTimeout.rb deleted file mode 100755 index ed839abb02..0000000000 --- a/test/test_clearTimeout.rb +++ /dev/null @@ -1,14 +0,0 @@ -#!/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 deleted file mode 100755 index e1d85850b5..0000000000 --- a/test/test_http_server_echo.rb +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/env ruby -require 'net/http' -require File.dirname(__FILE__) + "/common" - -pid = fork do - exec($node, $tf.path) -end - -begin - wait_for_server("localhost", 8000) - connection = Net::HTTP.new("localhost", 8000) - - response, body = connection.get("/") - assert_equal(response.code, "200") - assert(response.chunked?) - assert_equal(body, "\n") - assert_equal(response.content_type, "text/plain") - - response, body = connection.post("/", "hello world") - assert_equal(response.code, "200") - assert(response.chunked?) - assert_equal(body, "hello world\n") - assert_equal(response.content_type, "text/plain") -ensure - `kill -9 #{pid}` -end - -__END__ -function encode(data) { - var chunk = data.toString(); - return chunk.length.toString(16) + "\r\n" + chunk + "\r\n"; -} - -var port = 8000; -var server = new HTTPServer(null, port, function (request) { - - // onBody sends null on the last chunk. - request.onbody = function (chunk) { - if(chunk) { - this.respond(encode(chunk)); - } else { - this.respond(encode("\n")); - this.respond("0\r\n\r\n"); - this.respond(null); // signals end-of-request - } - } - request.respond("HTTP/1.0 200 OK\r\n"); - request.respond("Content-Type: text/plain\r\n"); - request.respond("Transfer-Encoding: chunked\r\n"); - request.respond("\r\n"); -}); - -log("Running at http://localhost:" + port + "/"); diff --git a/test/test_http_server_null_response.rb b/test/test_http_server_null_response.rb deleted file mode 100755 index 5bdc01c52f..0000000000 --- a/test/test_http_server_null_response.rb +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby -require 'net/http' -require File.dirname(__FILE__) + "/common" - -pid = fork do - exec($node, $tf.path) -end - -begin - wait_for_server("localhost", 8000) - connection = Net::HTTP.new("localhost", 8000) - - response, body = connection.get("/") -ensure - `kill -9 #{pid}` -end - -__END__ -var server = new HTTPServer(null, 8000, function (request) { - log("request"); - request.respond("HTTP/1.1 200 OK\r\n"); - request.respond("Content-Length: 0\r\n"); - request.respond("\r\n"); - request.respond(null); -}); diff --git a/test/test_setTimeout.rb b/test/test_setTimeout.rb deleted file mode 100755 index 7a0b0f08ea..0000000000 --- a/test/test_setTimeout.rb +++ /dev/null @@ -1,16 +0,0 @@ -#!/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);