Browse Source

fix whitespace errors

v0.7.4-release
Blake Mizerany 15 years ago
committed by Ryan Dahl
parent
commit
8c8534046c
  1. 4
      benchmark/http_simple.js
  2. 28
      benchmark/http_simple.rb
  3. 2
      lib/crypto.js
  4. 2
      lib/net.js
  5. 2
      lib/readline.js
  6. 16
      lib/repl.js
  7. 2
      lib/string_decoder.js
  8. 2
      src/node.cc
  9. 4
      src/node_buffer.cc
  10. 2
      src/node_cares.cc
  11. 2
      src/node_crypto.cc
  12. 4
      src/node_file.cc
  13. 8
      src/node_http_parser.cc
  14. 4
      src/node_idle_watcher.cc
  15. 2
      src/node_io_watcher.cc
  16. 16
      src/node_net.cc
  17. 4
      src/node_script.cc
  18. 2
      src/node_signal_watcher.cc
  19. 6
      src/node_signal_watcher.h
  20. 6
      test/disabled/test-dns.js
  21. 2
      test/fixtures/b/c.js
  22. 2
      test/fixtures/child_process_should_emit_error.js
  23. 2
      test/pummel/test-net-tls.js
  24. 4
      test/simple/test-crypto.js
  25. 2
      test/simple/test-eio-race4.js
  26. 2
      test/simple/test-event-emitter-modify-in-emit.js
  27. 2
      test/simple/test-fs-chmod.js
  28. 2
      test/simple/test-fs-error-messages.js
  29. 8
      test/simple/test-fs-realpath.js
  30. 4
      test/simple/test-http-cat.js
  31. 2
      test/simple/test-http-tls.js
  32. 2
      test/simple/test-http-upgrade-client.js
  33. 2
      test/simple/test-http-upgrade-server2.js
  34. 18
      test/simple/test-http-wget.js
  35. 2
      test/simple/test-net-binary.js
  36. 2
      test/simple/test-net-tls.js
  37. 2
      test/simple/test-sendfd.js
  38. 14
      test/simple/test-url.js

4
benchmark/http_simple.js

@ -28,7 +28,7 @@ http.createServer(function (req, res) {
if (command == "bytes") { if (command == "bytes") {
var n = parseInt(arg, 10) var n = parseInt(arg, 10)
if (n <= 0) if (n <= 0)
throw "bytes called with n <= 0" throw "bytes called with n <= 0"
if (stored[n] === undefined) { if (stored[n] === undefined) {
console.log("create stored[n]"); console.log("create stored[n]");
stored[n] = ""; stored[n] = "";
@ -64,7 +64,7 @@ http.createServer(function (req, res) {
var content_length = body.length.toString(); var content_length = body.length.toString();
res.writeHead( status res.writeHead( status
, { "Content-Type": "text/plain" , { "Content-Type": "text/plain"
, "Content-Length": content_length , "Content-Length": content_length
} }

28
benchmark/http_simple.rb

@ -7,45 +7,45 @@ end
def wait(seconds) def wait(seconds)
n = (seconds / 0.01).to_i n = (seconds / 0.01).to_i
n.times do n.times do
sleep(0.01) sleep(0.01)
#File.read(DIR + '/yahoo.html') #File.read(DIR + '/yahoo.html')
end end
end end
class SimpleApp class SimpleApp
@@responses = {} @@responses = {}
def initialize def initialize
@count = 0 @count = 0
end end
def deferred?(env) def deferred?(env)
false false
end end
def call(env) def call(env)
path = env['PATH_INFO'] || env['REQUEST_URI'] path = env['PATH_INFO'] || env['REQUEST_URI']
commands = path.split('/') commands = path.split('/')
@count += 1 @count += 1
if commands.include?('periodical_activity') and @count % 10 != 1 if commands.include?('periodical_activity') and @count % 10 != 1
return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"] return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"]
end end
if commands.include?('fibonacci') if commands.include?('fibonacci')
n = commands.last.to_i n = commands.last.to_i
raise "fibonacci called with n <= 0" if n <= 0 raise "fibonacci called with n <= 0" if n <= 0
body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ') body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ')
status = 200 status = 200
elsif commands.include?('wait') elsif commands.include?('wait')
n = commands.last.to_f n = commands.last.to_f
raise "wait called with n <= 0" if n <= 0 raise "wait called with n <= 0" if n <= 0
wait(n) wait(n)
body = "waited about #{n} seconds" body = "waited about #{n} seconds"
status = 200 status = 200
elsif commands.include?('bytes') elsif commands.include?('bytes')
n = commands.last.to_i n = commands.last.to_i
raise "bytes called with n <= 0" if n <= 0 raise "bytes called with n <= 0" if n <= 0
@ -56,17 +56,17 @@ class SimpleApp
n = 20 * 1024; n = 20 * 1024;
body = @@responses[n] || "C"*n body = @@responses[n] || "C"*n
status = 200 status = 200
elsif commands.include?('test_post_length') elsif commands.include?('test_post_length')
input_body = "" input_body = ""
while chunk = env['rack.input'].read(512) while chunk = env['rack.input'].read(512)
input_body << chunk input_body << chunk
end end
if env['CONTENT_LENGTH'].to_i == input_body.length if env['CONTENT_LENGTH'].to_i == input_body.length
body = "Content-Length matches input length" body = "Content-Length matches input length"
status = 200 status = 200
else else
body = "Content-Length doesn't matches input length! body = "Content-Length doesn't matches input length!
content_length = #{env['CONTENT_LENGTH'].to_i} content_length = #{env['CONTENT_LENGTH'].to_i}
input_body.length = #{input_body.length}" input_body.length = #{input_body.length}"
status = 500 status = 500
@ -75,7 +75,7 @@ class SimpleApp
status = 404 status = 404
body = "Undefined url" body = "Undefined url"
end end
body += "\r\n" body += "\r\n"
headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s } headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }
[status, headers, [body]] [status, headers, [body]]
@ -90,6 +90,6 @@ if $0 == __FILE__
require 'thin' require 'thin'
require 'ebb' require 'ebb'
# Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000) # Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000)
Thin::Server.start("0.0.0.0", 8000, SimpleApp.new) Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
# Ebb::start_server(SimpleApp.new, :port => 8000) # Ebb::start_server(SimpleApp.new, :port => 8000)
end end

2
lib/crypto.js

@ -3596,7 +3596,7 @@ try {
var Verify = binding.Verify; var Verify = binding.Verify;
var crypto = true; var crypto = true;
} catch (e) { } catch (e) {
var crypto = false; var crypto = false;
} }

2
lib/net.js

@ -363,7 +363,7 @@ function setImplmentationMethods (self) {
return bytesWritten; return bytesWritten;
}; };
var oldRead = self._readImpl; var oldRead = self._readImpl;
self._readImpl = function(buf, off, len, calledByIOWatcher) { self._readImpl = function(buf, off, len, calledByIOWatcher) {
assert(self.secure); assert(self.secure);

2
lib/readline.js

@ -164,7 +164,7 @@ Interface.prototype._ttyWrite = function (b) {
if (this.cursor === 0 && this.line.length === 0) { if (this.cursor === 0 && this.line.length === 0) {
this.close(); this.close();
} else if (this.cursor < this.line.length) { } else if (this.cursor < this.line.length) {
this.line = this.line.slice(0, this.cursor) this.line = this.line.slice(0, this.cursor)
+ this.line.slice(this.cursor+1, this.line.length) + this.line.slice(this.cursor+1, this.line.length)
; ;
this._refreshLine(); this._refreshLine();

16
lib/repl.js

@ -137,14 +137,14 @@ REPLServer.prototype.readline = function (cmd) {
/** /**
* Used to parse and execute the Node REPL commands. * Used to parse and execute the Node REPL commands.
* *
* @param {cmd} cmd The command entered to check * @param {cmd} cmd The command entered to check
* @returns {Boolean} If true it means don't continue parsing the command * @returns {Boolean} If true it means don't continue parsing the command
*/ */
REPLServer.prototype.parseREPLKeyword = function (cmd) { REPLServer.prototype.parseREPLKeyword = function (cmd) {
var self = this; var self = this;
switch (cmd) { switch (cmd) {
case ".break": case ".break":
self.buffered_cmd = ''; self.buffered_cmd = '';
@ -171,7 +171,7 @@ REPLServer.prototype.parseREPLKeyword = function (cmd) {
}; };
function trimWhitespace (cmd) { function trimWhitespace (cmd) {
var trimmer = /^\s*(.+)\s*$/m, var trimmer = /^\s*(.+)\s*$/m,
matches = trimmer.exec(cmd); matches = trimmer.exec(cmd);
if (matches && matches.length === 2) { if (matches && matches.length === 2) {
@ -183,7 +183,7 @@ function trimWhitespace (cmd) {
* Converts commands that use var and function <name>() to use the * Converts commands that use var and function <name>() to use the
* local exports.context when evaled. This provides a local context * local exports.context when evaled. This provides a local context
* on the REPL. * on the REPL.
* *
* @param {String} cmd The cmd to convert * @param {String} cmd The cmd to convert
* @returns {String} The converted command * @returns {String} The converted command
*/ */
@ -191,18 +191,18 @@ REPLServer.prototype.convertToContext = function (cmd) {
var self = this, matches, var self = this, matches,
scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m, scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m,
scopeFunc = /^\s*function\s*([_\w\$]+)/; scopeFunc = /^\s*function\s*([_\w\$]+)/;
// Replaces: var foo = "bar"; with: self.context.foo = bar; // Replaces: var foo = "bar"; with: self.context.foo = bar;
matches = scopeVar.exec(cmd); matches = scopeVar.exec(cmd);
if (matches && matches.length === 3) { if (matches && matches.length === 3) {
return "self.context." + matches[1] + matches[2]; return "self.context." + matches[1] + matches[2];
} }
// Replaces: function foo() {}; with: foo = function foo() {}; // Replaces: function foo() {}; with: foo = function foo() {};
matches = scopeFunc.exec(self.buffered_cmd); matches = scopeFunc.exec(self.buffered_cmd);
if (matches && matches.length === 2) { if (matches && matches.length === 2) {
return matches[1] + " = " + self.buffered_cmd; return matches[1] + " = " + self.buffered_cmd;
} }
return cmd; return cmd;
}; };

2
lib/string_decoder.js

@ -11,7 +11,7 @@ var StringDecoder = exports.StringDecoder = function (encoding) {
StringDecoder.prototype.write = function (buffer) { StringDecoder.prototype.write = function (buffer) {
// If not utf8... // If not utf8...
if (this.encoding !== 'utf8') { if (this.encoding !== 'utf8') {
return buffer.toString(this.encoding); return buffer.toString(this.encoding);
} }

2
src/node.cc

@ -1166,7 +1166,7 @@ static Handle<Value> SetGid(const Arguments& args) {
} }
int gid; int gid;
if (args[0]->IsNumber()) { if (args[0]->IsNumber()) {
gid = args[0]->Int32Value(); gid = args[0]->Int32Value();
} else if (args[0]->IsString()) { } else if (args[0]->IsString()) {

4
src/node_buffer.cc

@ -509,8 +509,8 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
enum encoding e = ParseEncoding(args[1], UTF8); enum encoding e = ParseEncoding(args[1], UTF8);
Local<Integer> length = Local<Integer> length =
Integer::New(e == UTF8 ? s->Utf8Length() : s->Length()); Integer::New(e == UTF8 ? s->Utf8Length() : s->Length());
return scope.Close(length); return scope.Close(length);
} }

2
src/node_cares.cc

@ -24,7 +24,7 @@ using namespace v8;
static Handle<Value> IsIP(const Arguments& args) { static Handle<Value> IsIP(const Arguments& args) {
HandleScope scope; HandleScope scope;
if (!args[0]->IsString()) { if (!args[0]->IsString()) {
return scope.Close(Integer::New(4)); return scope.Close(Integer::New(4));
} }

2
src/node_crypto.cc

@ -1004,7 +1004,7 @@ class Cipher : public ObjectWrap {
delete [] buf; delete [] buf;
Local<Value> outString; Local<Value> outString;
if (out_len==0) { if (out_len==0) {
outString=String::New(""); outString=String::New("");
} else { } else {
if (args.Length() <= 2 || !args[2]->IsString()) { if (args.Length() <= 2 || !args[2]->IsString()) {

4
src/node_file.cc

@ -432,7 +432,7 @@ static Handle<Value> MKDir(const Arguments& args) {
static Handle<Value> SendFile(const Arguments& args) { static Handle<Value> SendFile(const Arguments& args) {
HandleScope scope; HandleScope scope;
if (args.Length() < 4 || if (args.Length() < 4 ||
!args[0]->IsInt32() || !args[0]->IsInt32() ||
!args[1]->IsInt32() || !args[1]->IsInt32() ||
!args[3]->IsNumber()) { !args[3]->IsNumber()) {
@ -704,7 +704,7 @@ void File::Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "readlink", ReadLink); NODE_SET_METHOD(target, "readlink", ReadLink);
NODE_SET_METHOD(target, "unlink", Unlink); NODE_SET_METHOD(target, "unlink", Unlink);
NODE_SET_METHOD(target, "write", Write); NODE_SET_METHOD(target, "write", Write);
NODE_SET_METHOD(target, "chmod", Chmod); NODE_SET_METHOD(target, "chmod", Chmod);
NODE_SET_METHOD(target, "chown", Chown); NODE_SET_METHOD(target, "chown", Chown);

8
src/node_http_parser.cc

@ -21,7 +21,7 @@
// No copying is performed when slicing the buffer, only small reference // No copying is performed when slicing the buffer, only small reference
// allocations. // allocations.
namespace node { namespace node {
using namespace v8; using namespace v8;
@ -194,7 +194,7 @@ class Parser : public ObjectWrap {
String::Utf8Value type(args[0]->ToString()); String::Utf8Value type(args[0]->ToString());
Parser *parser; Parser *parser;
if (0 == strcasecmp(*type, "request")) { if (0 == strcasecmp(*type, "request")) {
parser = new Parser(HTTP_REQUEST); parser = new Parser(HTTP_REQUEST);
@ -257,7 +257,7 @@ class Parser : public ObjectWrap {
if (parser->got_exception_) return Local<Value>(); if (parser->got_exception_) return Local<Value>();
Local<Integer> nparsed_obj = Integer::New(nparsed); Local<Integer> nparsed_obj = Integer::New(nparsed);
// If there was a parse error in one of the callbacks // If there was a parse error in one of the callbacks
// TODO What if there is an error on EOF? // TODO What if there is an error on EOF?
if (!parser->parser_.upgrade && nparsed != len) { if (!parser->parser_.upgrade && nparsed != len) {
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error")); Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
@ -333,7 +333,7 @@ static Handle<Value> UrlDecode (const Arguments& args) {
enum { CHAR, HEX0, HEX1 } state = CHAR; enum { CHAR, HEX0, HEX1 } state = CHAR;
int n, m, hexchar; int n, m, hexchar;
size_t in_index = 0, out_index = 0; size_t in_index = 0, out_index = 0;
char c; char c;
for (; in_index <= l; in_index++) { for (; in_index <= l; in_index++) {

4
src/node_idle_watcher.cc

@ -38,7 +38,7 @@ Handle<Value> IdleWatcher::SetPriority(const Arguments& args) {
HandleScope scope; HandleScope scope;
int priority = args[0]->Int32Value(); int priority = args[0]->Int32Value();
ev_set_priority(&idle->watcher_, priority); ev_set_priority(&idle->watcher_, priority);
return Undefined(); return Undefined();
@ -71,7 +71,7 @@ void IdleWatcher::Callback(EV_P_ ev_idle *w, int revents) {
} }
// //
// var idle = new process.IdleWatcher(); // var idle = new process.IdleWatcher();
// idle.callback = function () { /* ... */ }; // idle.callback = function () { /* ... */ };
// idle.start(); // idle.start();

2
src/node_io_watcher.cc

@ -61,7 +61,7 @@ void IOWatcher::Callback(EV_P_ ev_io *w, int revents) {
} }
// //
// var io = new process.IOWatcher(); // var io = new process.IOWatcher();
// process.callback = function (readable, writable) { ... }; // process.callback = function (readable, writable) { ... };
// io.set(fd, true, false); // io.set(fd, true, false);

16
src/node_net.cc

@ -214,7 +214,7 @@ static inline Handle<Value> ParseAddressArgs(Handle<Value> first,
memset(&in6, 0, sizeof in6); memset(&in6, 0, sizeof in6);
int port = first->Int32Value(); int port = first->Int32Value();
in.sin_port = in6.sin6_port = htons(port); in.sin_port = in6.sin6_port = htons(port);
in.sin_family = AF_INET; in.sin_family = AF_INET;
in6.sin6_family = AF_INET6; in6.sin6_family = AF_INET6;
@ -241,7 +241,7 @@ static inline Handle<Value> ParseAddressArgs(Handle<Value> first,
} }
// Bind with UNIX // Bind with UNIX
// t.bind(fd, "/tmp/socket") // t.bind(fd, "/tmp/socket")
// Bind with TCP // Bind with TCP
// t.bind(fd, 80, "192.168.11.2") // t.bind(fd, 80, "192.168.11.2")
@ -486,7 +486,7 @@ static Handle<Value> SocketError(const Arguments& args) {
return ThrowException(ErrnoException(errno, "getsockopt")); return ThrowException(ErrnoException(errno, "getsockopt"));
} }
return scope.Close(Integer::New(error)); return scope.Close(Integer::New(error));
} }
@ -572,7 +572,7 @@ static Handle<Value> RecvFrom(const Arguments& args) {
struct sockaddr_storage address_storage; struct sockaddr_storage address_storage;
socklen_t addrlen = sizeof(struct sockaddr_storage); socklen_t addrlen = sizeof(struct sockaddr_storage);
ssize_t bytes_read = recvfrom(fd, (char*)buffer->data() + off, len, flags, ssize_t bytes_read = recvfrom(fd, (char*)buffer->data() + off, len, flags,
(struct sockaddr*) &address_storage, &addrlen); (struct sockaddr*) &address_storage, &addrlen);
if (bytes_read < 0) { if (bytes_read < 0) {
@ -653,7 +653,7 @@ static Handle<Value> RecvMsg(const Arguments& args) {
// //
// XXX: Some implementations can send multiple file descriptors in a // XXX: Some implementations can send multiple file descriptors in a
// single message. We should be using CMSG_NXTHDR() to walk the // single message. We should be using CMSG_NXTHDR() to walk the
// chain to get at them all. This would require changing the // chain to get at them all. This would require changing the
// API to hand these back up the caller, is a pain. // API to hand these back up the caller, is a pain.
int received_fd = -1; int received_fd = -1;
@ -696,7 +696,7 @@ static Handle<Value> Write(const Arguments& args) {
FD_ARG(args[0]) FD_ARG(args[0])
if (!Buffer::HasInstance(args[1])) { if (!Buffer::HasInstance(args[1])) {
return ThrowException(Exception::TypeError( return ThrowException(Exception::TypeError(
String::New("Second argument should be a buffer"))); String::New("Second argument should be a buffer")));
} }
@ -1177,7 +1177,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
static Handle<Value> IsIP(const Arguments& args) { static Handle<Value> IsIP(const Arguments& args) {
HandleScope scope; HandleScope scope;
if (!args[0]->IsString()) { if (!args[0]->IsString()) {
return scope.Close(Integer::New(4)); return scope.Close(Integer::New(4));
} }
@ -1206,7 +1206,7 @@ static Handle<Value> CreateErrnoException(const Arguments& args) {
int errorno = args[0]->Int32Value(); int errorno = args[0]->Int32Value();
String::Utf8Value syscall(args[1]->ToString()); String::Utf8Value syscall(args[1]->ToString());
Local<Value> exception = ErrnoException(errorno, *syscall); Local<Value> exception = ErrnoException(errorno, *syscall);
return scope.Close(exception); return scope.Close(exception);
} }

4
src/node_script.cc

@ -181,7 +181,7 @@ template <node::Script::EvalInputFlags iFlag,
} }
const int fnIndex = sbIndex + (cFlag == newContext ? 1 : 0); const int fnIndex = sbIndex + (cFlag == newContext ? 1 : 0);
Local<String> filename = args.Length() > fnIndex Local<String> filename = args.Length() > fnIndex
? args[fnIndex]->ToString() ? args[fnIndex]->ToString()
: String::New("evalmachine.<anonymous>"); : String::New("evalmachine.<anonymous>");
@ -253,7 +253,7 @@ template <node::Script::EvalInputFlags iFlag,
if (!nScript) { if (!nScript) {
return ThrowException(Exception::Error( return ThrowException(Exception::Error(
String::New("Must be called as a method of Script."))); String::New("Must be called as a method of Script.")));
} }
nScript->script_ = Persistent<v8::Script>::New(script); nScript->script_ = Persistent<v8::Script>::New(script);
result = args.This(); result = args.This();
} }

2
src/node_signal_watcher.cc

@ -22,7 +22,7 @@ void SignalWatcher::Initialize(Handle<Object> target) {
target->Set(String::NewSymbol("SignalWatcher"), target->Set(String::NewSymbol("SignalWatcher"),
constructor_template->GetFunction()); constructor_template->GetFunction());
callback_symbol = NODE_PSYMBOL("callback"); callback_symbol = NODE_PSYMBOL("callback");
} }

6
src/node_signal_watcher.h

@ -21,7 +21,7 @@ class SignalWatcher : ObjectWrap {
ev_signal_init(&watcher_, SignalWatcher::Callback, sig); ev_signal_init(&watcher_, SignalWatcher::Callback, sig);
watcher_.data = this; watcher_.data = this;
} }
~SignalWatcher() { ~SignalWatcher() {
ev_signal_stop(EV_DEFAULT_UC_ &watcher_); ev_signal_stop(EV_DEFAULT_UC_ &watcher_);
} }
@ -32,10 +32,10 @@ class SignalWatcher : ObjectWrap {
private: private:
static void Callback(EV_P_ ev_signal *watcher, int revents); static void Callback(EV_P_ ev_signal *watcher, int revents);
void Start(); void Start();
void Stop(); void Stop();
ev_signal watcher_; ev_signal watcher_;
}; };

6
test/disabled/test-dns.js

@ -21,7 +21,7 @@ var hosts = ['example.com',
'google.com', // MX, multiple A records 'google.com', // MX, multiple A records
'_xmpp-client._tcp.google.com', // SRV '_xmpp-client._tcp.google.com', // SRV
'oakalynhall.co.uk' // Multiple PTR replies 'oakalynhall.co.uk' // Multiple PTR replies
]; ];
var records = ['A', 'AAAA', 'MX', 'TXT', 'SRV']; var records = ['A', 'AAAA', 'MX', 'TXT', 'SRV'];
@ -58,12 +58,12 @@ function checkDnsRecord(host, record) {
while (ll--) { while (ll--) {
var ip = result[ll]; var ip = result[ll];
var reverseCmd = "host " + ip + var reverseCmd = "host " + ip +
"| cut -d \" \" -f 5-" + "| cut -d \" \" -f 5-" +
"| sed -e 's/\\.$//'"; "| sed -e 's/\\.$//'";
child_process.exec(reverseCmd, checkReverse(ip)); child_process.exec(reverseCmd, checkReverse(ip));
} }
}); });
break; break;
case "MX": case "MX":
dns.resolve(myHost, myRecord, function (error, result, ttl, cname) { dns.resolve(myHost, myRecord, function (error, result, ttl, cname) {

2
test/fixtures/b/c.js

@ -11,7 +11,7 @@ debug("load fixtures/b/c.js");
var string = "C"; var string = "C";
exports.SomeClass = function() { exports.SomeClass = function() {
}; };
exports.C = function () { exports.C = function () {

2
test/fixtures/child_process_should_emit_error.js

@ -1,4 +1,4 @@
var exec = require('child_process').exec, var exec = require('child_process').exec,
puts = require('sys').puts; puts = require('sys').puts;
[0, 1].forEach(function(i) { [0, 1].forEach(function(i) {

2
test/pummel/test-net-tls.js

@ -102,7 +102,7 @@ try {
have_tls=true; have_tls=true;
} catch (e) { } catch (e) {
have_tls=false; have_tls=false;
} }
if (have_tls) { if (have_tls) {
var caPem = fs.readFileSync(fixturesDir+"/test_ca.pem"); var caPem = fs.readFileSync(fixturesDir+"/test_ca.pem");

4
test/simple/test-crypto.js

@ -5,7 +5,7 @@ try {
} catch (e) { } catch (e) {
console.log("Not compiled with OPENSSL support."); console.log("Not compiled with OPENSSL support.");
process.exit(); process.exit();
} }
var fs = require('fs'); var fs = require('fs');
var sys = require('sys'); var sys = require('sys');
@ -68,7 +68,7 @@ var encryption_key = '0123456789abcd0123456789';
var iv = '12345678'; var iv = '12345678';
var cipher = crypto.createCipheriv("des-ede3-cbc", encryption_key, iv); var cipher = crypto.createCipheriv("des-ede3-cbc", encryption_key, iv);
var ciph = cipher.update(plaintext, 'utf8', 'hex'); var ciph = cipher.update(plaintext, 'utf8', 'hex');
ciph += cipher.final('hex'); ciph += cipher.final('hex');
var decipher = crypto.createDecipheriv("des-ede3-cbc",encryption_key,iv); var decipher = crypto.createDecipheriv("des-ede3-cbc",encryption_key,iv);

2
test/simple/test-eio-race4.js

@ -12,7 +12,7 @@ for (var i = 0; i < N; i++) {
} else { } else {
throw new Error("this shouldn't be called"); throw new Error("this shouldn't be called");
} }
}); });
} }
process.addListener("exit", function () { process.addListener("exit", function () {

2
test/simple/test-event-emitter-modify-in-emit.js

@ -43,7 +43,7 @@ assert.equal(2, e.listeners("foo").length)
e.removeAllListeners("foo") e.removeAllListeners("foo")
assert.equal(0, e.listeners("foo").length) assert.equal(0, e.listeners("foo").length)
// Verify that removing callbacks while in emit allows emits to propagate to // Verify that removing callbacks while in emit allows emits to propagate to
// all listeners // all listeners
callbacks_called = [ ]; callbacks_called = [ ];

2
test/simple/test-fs-chmod.js

@ -12,7 +12,7 @@ fs.chmod(file, 0777, function (err) {
} else { } else {
console.log(fs.statSync(file).mode); console.log(fs.statSync(file).mode);
assert.equal(0777, fs.statSync(file).mode & 0777); assert.equal(0777, fs.statSync(file).mode & 0777);
fs.chmodSync(file, 0644); fs.chmodSync(file, 0644);
assert.equal(0644, fs.statSync(file).mode & 0777); assert.equal(0644, fs.statSync(file).mode & 0777);
success_count++; success_count++;

2
test/simple/test-fs-error-messages.js

@ -158,6 +158,6 @@ try {
} }
process.addListener('exit', function () { process.addListener('exit', function () {
assert.equal(expected, errors.length, assert.equal(expected, errors.length,
'Test fs sync exceptions raised, got ' + errors.length + ' expected ' + expected); 'Test fs sync exceptions raised, got ' + errors.length + ' expected ' + expected);
}); });

8
test/simple/test-fs-realpath.js

@ -9,7 +9,7 @@ function asynctest(testBlock, args, callback, assertBlock) {
var ignoreError = false; var ignoreError = false;
if (assertBlock) { if (assertBlock) {
try { try {
ignoreError = assertBlock.apply(assertBlock, ignoreError = assertBlock.apply(assertBlock,
Array.prototype.slice.call(arguments)); Array.prototype.slice.call(arguments));
} }
catch (e) { catch (e) {
@ -106,7 +106,7 @@ function test_deep_relative_dir_symlink(callback) {
unlink.push(entry); unlink.push(entry);
assert.equal(fs.realpathSync(entry), expected); assert.equal(fs.realpathSync(entry), expected);
asynctest(fs.realpath, [entry], callback, function(err, result){ asynctest(fs.realpath, [entry], callback, function(err, result){
assert.equal(result, expected, assert.equal(result, expected,
'got '+inspect(result)+' expected '+inspect(expected)); 'got '+inspect(result)+' expected '+inspect(expected));
@ -168,9 +168,9 @@ function test_deep_symlink_mix(callback) {
/tmp/node-test-realpath-f1 -> ../tmp/node-test-realpath-d1/foo /tmp/node-test-realpath-f1 -> ../tmp/node-test-realpath-d1/foo
/tmp/node-test-realpath-d1 -> ../node-test-realpath-d2 /tmp/node-test-realpath-d1 -> ../node-test-realpath-d2
/tmp/node-test-realpath-d2/foo -> ../node-test-realpath-f2 /tmp/node-test-realpath-d2/foo -> ../node-test-realpath-f2
/tmp/node-test-realpath-f2 /tmp/node-test-realpath-f2
-> /node/test/fixtures/nested-index/one/realpath-c -> /node/test/fixtures/nested-index/one/realpath-c
/node/test/fixtures/nested-index/one/realpath-c /node/test/fixtures/nested-index/one/realpath-c
-> /node/test/fixtures/nested-index/two/realpath-c -> /node/test/fixtures/nested-index/two/realpath-c
/node/test/fixtures/nested-index/two/realpath-c -> ../../cycles/root.js /node/test/fixtures/nested-index/two/realpath-c -> ../../cycles/root.js
/node/test/fixtures/cycles/root.js (hard) /node/test/fixtures/cycles/root.js (hard)

4
test/simple/test-http-cat.js

@ -27,10 +27,10 @@ server.listen(PORT, function () {
}); });
http.cat("http://localhost:12312/", "utf8", function (err, content) { http.cat("http://localhost:12312/", "utf8", function (err, content) {
if (err) { if (err) {
console.log("got error (this should happen)"); console.log("got error (this should happen)");
bad_server_got_error = true; bad_server_got_error = true;
} }
}); });
}); });

2
test/simple/test-http-tls.js

@ -16,7 +16,7 @@ try {
have_openssl=false; have_openssl=false;
console.log("Not compiled with OPENSSL support."); console.log("Not compiled with OPENSSL support.");
process.exit(); process.exit();
} }
var request_number = 0; var request_number = 0;
var requests_sent = 0; var requests_sent = 0;

2
test/simple/test-http-upgrade-client.js

@ -31,7 +31,7 @@ var parseHeaders = function(data) {
return o; return o;
}; };
// Create a TCP server // Create a TCP server
var srv = net.createServer(function(c) { var srv = net.createServer(function(c) {
var data = ''; var data = '';
c.addListener('data', function(d) { c.addListener('data', function(d) {

2
test/simple/test-http-upgrade-server2.js

@ -10,7 +10,7 @@ server = http.createServer(function (req, res) {
server.addListener('upgrade', function (req, socket, upgradeHead) { server.addListener('upgrade', function (req, socket, upgradeHead) {
error('got upgrade event'); error('got upgrade event');
// test that throwing an error from upgrade gets // test that throwing an error from upgrade gets
// is uncaught // is uncaught
throw new Error('upgrade error'); throw new Error('upgrade error');
}); });

18
test/simple/test-http-wget.js

@ -4,17 +4,17 @@ http = require("http");
// wget sends an HTTP/1.0 request with Connection: Keep-Alive // wget sends an HTTP/1.0 request with Connection: Keep-Alive
// //
// Sending back a chunked response to an HTTP/1.0 client would be wrong, // Sending back a chunked response to an HTTP/1.0 client would be wrong,
// so what has to happen in this case is that the connection is closed // so what has to happen in this case is that the connection is closed
// by the server after the entity body if the Content-Length was not // by the server after the entity body if the Content-Length was not
// sent. // sent.
// //
// If the Content-Length was sent, we can probably safely honor the // If the Content-Length was sent, we can probably safely honor the
// keep-alive request, even though HTTP 1.0 doesn't say that the // keep-alive request, even though HTTP 1.0 doesn't say that the
// connection can be kept open. Presumably any client sending this // connection can be kept open. Presumably any client sending this
// header knows that it is extending HTTP/1.0 and can handle the // header knows that it is extending HTTP/1.0 and can handle the
// response. We don't test that here however, just that if the // response. We don't test that here however, just that if the
// content-length is not provided, that the connection is in fact // content-length is not provided, that the connection is in fact
// closed. // closed.
var server_response = ""; var server_response = "";

2
test/simple/test-net-binary.js

@ -9,7 +9,7 @@ for (var i = 255; i >= 0; i--) {
+ " " + " "
+ JSON.stringify(S) + JSON.stringify(S)
+ " " + " "
+ JSON.stringify(String.fromCharCode(i)) + JSON.stringify(String.fromCharCode(i))
+ " " + " "
+ S.charCodeAt(0) + S.charCodeAt(0)
); );

2
test/simple/test-net-tls.js

@ -11,7 +11,7 @@ try {
have_openssl=false; have_openssl=false;
console.log("Not compiled with OPENSSL support."); console.log("Not compiled with OPENSSL support.");
process.exit(); process.exit();
} }
var caPem = fs.readFileSync(fixturesDir+"/test_ca.pem", 'ascii'); var caPem = fs.readFileSync(fixturesDir+"/test_ca.pem", 'ascii');
var certPem = fs.readFileSync(fixturesDir+"/test_cert.pem", 'ascii'); var certPem = fs.readFileSync(fixturesDir+"/test_cert.pem", 'ascii');

2
test/simple/test-sendfd.js

@ -59,7 +59,7 @@ var logChild = function(d) {
}; };
// Create a pipe // Create a pipe
// //
// We establish a listener on the read end of the pipe so that we can // We establish a listener on the read end of the pipe so that we can
// validate any data sent back by the child. We send the write end of the // validate any data sent back by the child. We send the write end of the
// pipe to the child and close it off in our process. // pipe to the child and close it off in our process.

14
test/simple/test-url.js

@ -169,10 +169,10 @@ for (var u in parseTests) {
a = JSON.stringify(actual[i]); a = JSON.stringify(actual[i]);
assert.equal(e, a, "parse(" + u + ")."+i+" == "+e+"\nactual: "+a); assert.equal(e, a, "parse(" + u + ")."+i+" == "+e+"\nactual: "+a);
} }
var expected = u, var expected = u,
actual = url.format(parseTests[u]); actual = url.format(parseTests[u]);
assert.equal(expected, actual, "format("+u+") == "+u+"\nactual:"+actual); assert.equal(expected, actual, "format("+u+") == "+u+"\nactual:"+actual);
} }
@ -250,13 +250,13 @@ for (var u in formatTests) {
}); });
// //
// Tests below taken from Chiron // Tests below taken from Chiron
// http://code.google.com/p/chironjs/source/browse/trunk/src/test/http/url.js // http://code.google.com/p/chironjs/source/browse/trunk/src/test/http/url.js
// //
// Copyright (c) 2002-2008 Kris Kowal <http://cixar.com/~kris.kowal> // Copyright (c) 2002-2008 Kris Kowal <http://cixar.com/~kris.kowal>
// used with permission under MIT License // used with permission under MIT License
// //
// Changes marked with @isaacs // Changes marked with @isaacs
var bases = [ var bases = [
@ -392,7 +392,7 @@ var bases = [
['./' , bases[3], 'fred:///s//a/b/'], ['./' , bases[3], 'fred:///s//a/b/'],
['../' , bases[3], 'fred:///s//a/'], ['../' , bases[3], 'fred:///s//a/'],
['../g' , bases[3], 'fred:///s//a/g'], ['../g' , bases[3], 'fred:///s//a/g'],
['../../' , bases[3], 'fred:///s//'], ['../../' , bases[3], 'fred:///s//'],
['../../g' , bases[3], 'fred:///s//g'], ['../../g' , bases[3], 'fred:///s//g'],
['../../../g', bases[3], 'fred:///s/g'], ['../../../g', bases[3], 'fred:///s/g'],
@ -512,5 +512,5 @@ var bases = [
assert.equal(e, a, assert.equal(e, a,
"resolve("+[relativeTest[1], relativeTest[0]]+") == "+e+ "resolve("+[relativeTest[1], relativeTest[0]]+") == "+e+
"\n actual="+a); "\n actual="+a);
}); });

Loading…
Cancel
Save