mirror of https://github.com/lukechilds/node.git
Oleg Efimov
14 years ago
committed by
Ryan Dahl
50 changed files with 483 additions and 482 deletions
@ -1,25 +1,25 @@ |
|||||
var c = require("./b/c"); |
var c = require('./b/c'); |
||||
|
|
||||
common.debug("load fixtures/a.js"); |
common.debug('load fixtures/a.js'); |
||||
|
|
||||
var string = "A"; |
var string = 'A'; |
||||
|
|
||||
exports.SomeClass = c.SomeClass; |
exports.SomeClass = c.SomeClass; |
||||
|
|
||||
exports.A = function () { |
exports.A = function() { |
||||
return string; |
return string; |
||||
}; |
}; |
||||
|
|
||||
exports.C = function () { |
exports.C = function() { |
||||
return c.C(); |
return c.C(); |
||||
}; |
}; |
||||
|
|
||||
exports.D = function () { |
exports.D = function() { |
||||
return c.D(); |
return c.D(); |
||||
}; |
}; |
||||
|
|
||||
exports.number = 42; |
exports.number = 42; |
||||
|
|
||||
process.addListener("exit", function () { |
process.addListener('exit', function() { |
||||
string = "A done"; |
string = 'A done'; |
||||
}); |
}); |
||||
|
@ -1,28 +1,28 @@ |
|||||
var d = require("./d"); |
var d = require('./d'); |
||||
|
|
||||
var assert = require("assert"); |
var assert = require('assert'); |
||||
|
|
||||
var package = require("./package"); |
var package = require('./package'); |
||||
|
|
||||
assert.equal("world", package.hello); |
assert.equal('world', package.hello); |
||||
|
|
||||
common.debug("load fixtures/b/c.js"); |
common.debug('load fixtures/b/c.js'); |
||||
|
|
||||
var string = "C"; |
var string = 'C'; |
||||
|
|
||||
exports.SomeClass = function() { |
exports.SomeClass = function() { |
||||
|
|
||||
}; |
}; |
||||
|
|
||||
exports.C = function () { |
exports.C = function() { |
||||
return string; |
return string; |
||||
}; |
}; |
||||
|
|
||||
exports.D = function () { |
exports.D = function() { |
||||
return d.D(); |
return d.D(); |
||||
}; |
}; |
||||
|
|
||||
process.addListener("exit", function () { |
process.addListener('exit', function() { |
||||
string = "C done"; |
string = 'C done'; |
||||
console.log("b/c.js exit"); |
console.log('b/c.js exit'); |
||||
}); |
}); |
||||
|
@ -1,12 +1,12 @@ |
|||||
common.debug("load fixtures/b/d.js"); |
common.debug('load fixtures/b/d.js'); |
||||
|
|
||||
var string = "D"; |
var string = 'D'; |
||||
|
|
||||
exports.D = function () { |
exports.D = function() { |
||||
return string; |
return string; |
||||
}; |
}; |
||||
|
|
||||
process.addListener("exit", function () { |
process.addListener('exit', function() { |
||||
string = "D done"; |
string = 'D done'; |
||||
}); |
}); |
||||
|
|
||||
|
@ -1,2 +1,2 @@ |
|||||
exports.hello = "world"; |
exports.hello = 'world'; |
||||
common.debug("load package/index.js"); |
common.debug('load package/index.js'); |
||||
|
@ -1,8 +1,8 @@ |
|||||
var exec = require('child_process').exec; |
var exec = require('child_process').exec; |
||||
|
|
||||
[0, 1].forEach(function(i) { |
[0, 1].forEach(function(i) { |
||||
exec('ls', function(err, stdout, stderr) { |
exec('ls', function(err, stdout, stderr) { |
||||
console.log(i); |
console.log(i); |
||||
throw new Error('hello world'); |
throw new Error('hello world'); |
||||
}); |
}); |
||||
}); |
}); |
||||
|
@ -1,6 +1,6 @@ |
|||||
|
|
||||
var root = require("./../root"); |
var root = require('./../root'); |
||||
|
|
||||
exports.hello = function () { |
exports.hello = function() { |
||||
return root.calledFromFoo(); |
return root.calledFromFoo(); |
||||
}; |
}; |
||||
|
@ -1,10 +1,10 @@ |
|||||
|
|
||||
var foo = exports.foo = require("./folder/foo"); |
var foo = exports.foo = require('./folder/foo'); |
||||
|
|
||||
exports.hello = "hello"; |
exports.hello = 'hello'; |
||||
exports.sayHello = function () { |
exports.sayHello = function() { |
||||
return foo.hello(); |
return foo.hello(); |
||||
}; |
}; |
||||
exports.calledFromFoo = function () { |
exports.calledFromFoo = function() { |
||||
return exports.hello; |
return exports.hello; |
||||
}; |
}; |
||||
|
@ -1,14 +1,14 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert; |
assert = common.assert; |
||||
|
|
||||
common.print("hello world\r\n"); |
common.print('hello world\r\n'); |
||||
|
|
||||
var stdin = process.openStdin(); |
var stdin = process.openStdin(); |
||||
|
|
||||
stdin.addListener("data", function (data) { |
stdin.addListener('data', function(data) { |
||||
process.stdout.write(data.toString()); |
process.stdout.write(data.toString()); |
||||
}); |
}); |
||||
|
|
||||
stdin.addListener("end", function () { |
stdin.addListener('end', function() { |
||||
process.stdout.end(); |
process.stdout.end(); |
||||
}); |
}); |
||||
|
@ -1,4 +1,4 @@ |
|||||
foo = "foo"; |
foo = 'foo'; |
||||
global.bar = "bar"; |
global.bar = 'bar'; |
||||
|
|
||||
exports.fooBar = {foo: global.foo, bar:bar}; |
exports.fooBar = {foo: global.foo, bar: bar}; |
||||
|
@ -1,2 +1,2 @@ |
|||||
exports.hello = "hello from one!"; |
exports.hello = 'hello from one!'; |
||||
|
|
||||
|
@ -1,2 +1,2 @@ |
|||||
exports.hello = "hello from two!"; |
exports.hello = 'hello from two!'; |
||||
|
|
||||
|
@ -1,32 +1,32 @@ |
|||||
process.mixin(require("../common")); |
process.mixin(require('../common')); |
||||
net = require("net"); |
net = require('net'); |
||||
|
|
||||
path = process.ARGV[2]; |
path = process.ARGV[2]; |
||||
greeting = process.ARGV[3]; |
greeting = process.ARGV[3]; |
||||
|
|
||||
receiver = net.createServer(function(socket) { |
receiver = net.createServer(function(socket) { |
||||
socket.addListener("fd", function(fd) { |
socket.addListener('fd', function(fd) { |
||||
var peerInfo = process.getpeername(fd); |
var peerInfo = process.getpeername(fd); |
||||
peerInfo.fd = fd; |
peerInfo.fd = fd; |
||||
var passedSocket = new net.Socket(peerInfo); |
var passedSocket = new net.Socket(peerInfo); |
||||
|
|
||||
passedSocket.addListener("eof", function() { |
passedSocket.addListener('eof', function() { |
||||
passedSocket.close(); |
passedSocket.close(); |
||||
}); |
}); |
||||
|
|
||||
passedSocket.addListener("data", function(data) { |
passedSocket.addListener('data', function(data) { |
||||
passedSocket.send("[echo] " + data); |
passedSocket.send('[echo] ' + data); |
||||
}); |
}); |
||||
passedSocket.addListener("close", function() { |
passedSocket.addListener('close', function() { |
||||
receiver.close(); |
receiver.close(); |
||||
}); |
}); |
||||
passedSocket.send("[greeting] " + greeting); |
passedSocket.send('[greeting] ' + greeting); |
||||
}); |
}); |
||||
}); |
}); |
||||
|
|
||||
/* To signal the test runne we're up and listening */ |
/* To signal the test runne we're up and listening */ |
||||
receiver.addListener("listening", function() { |
receiver.addListener('listening', function() { |
||||
common.print("ready"); |
common.print('ready'); |
||||
}); |
}); |
||||
|
|
||||
receiver.listen(path); |
receiver.listen(path); |
||||
|
@ -1,10 +1,12 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
Buffer = require("buffer").Buffer; |
Buffer = require('buffer').Buffer; |
||||
|
|
||||
var n = parseInt(process.argv[2]); |
var n = parseInt(process.argv[2]); |
||||
|
|
||||
b = new Buffer(n); |
b = new Buffer(n); |
||||
for (var i = 0; i < n; i++) { b[i] = 100; } |
for (var i = 0; i < n; i++) { |
||||
|
b[i] = 100; |
||||
|
} |
||||
|
|
||||
process.stdout.write(b); |
process.stdout.write(b); |
||||
|
@ -1,8 +1,8 @@ |
|||||
var path = require("path"); |
var path = require('path'); |
||||
|
|
||||
require.paths.unshift(path.join(__dirname,"../p2")); |
require.paths.unshift(path.join(__dirname, '../p2')); |
||||
|
|
||||
exports.foo = require("foo"); |
exports.foo = require('foo'); |
||||
|
|
||||
exports.expect = require(path.join(__dirname, "../p2/bar")); |
exports.expect = require(path.join(__dirname, '../p2/bar')); |
||||
exports.actual = exports.foo.bar; |
exports.actual = exports.foo.bar; |
||||
|
@ -1,2 +1,2 @@ |
|||||
require.paths.unshift(__dirname); |
require.paths.unshift(__dirname); |
||||
exports.bar = require("bar"); |
exports.bar = require('bar'); |
||||
|
@ -1,2 +1,2 @@ |
|||||
require.paths.unshift(__dirname); |
require.paths.unshift(__dirname); |
||||
exports.bar = require("bar"); // surprise! this is not /p2/bar, this is /p1/bar
|
exports.bar = require('bar'); // surprise! this is not /p2/bar, this is /p1/bar
|
||||
|
@ -1,6 +1,6 @@ |
|||||
function tmp() {} |
function tmp() {} |
||||
process.addListener("SIGINT", tmp); |
process.addListener('SIGINT', tmp); |
||||
process.removeListener("SIGINT", tmp); |
process.removeListener('SIGINT', tmp); |
||||
setInterval(function () { |
setInterval(function() { |
||||
process.stdout.write('keep alive\n'); |
process.stdout.write('keep alive\n'); |
||||
}, 1000); |
}, 1000); |
||||
|
@ -1 +1 @@ |
|||||
throw new Error("blah"); |
throw new Error('blah'); |
||||
|
@ -1 +1 @@ |
|||||
throw new Error("blah"); |
throw new Error('blah'); |
||||
|
@ -1,3 +1,3 @@ |
|||||
process.nextTick(function () { |
process.nextTick(function() { |
||||
JSON.parse(undefined); |
JSON.parse(undefined); |
||||
}); |
}); |
||||
|
@ -1,49 +1,49 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
|
|
||||
util = require('util'); |
util = require('util'); |
||||
console.log([ |
console.log([ |
||||
'_______________________________________________50', |
'_______________________________________________50', |
||||
'______________________________________________100', |
'______________________________________________100', |
||||
'______________________________________________150', |
'______________________________________________150', |
||||
'______________________________________________200', |
'______________________________________________200', |
||||
'______________________________________________250', |
'______________________________________________250', |
||||
'______________________________________________300', |
'______________________________________________300', |
||||
'______________________________________________350', |
'______________________________________________350', |
||||
'______________________________________________400', |
'______________________________________________400', |
||||
'______________________________________________450', |
'______________________________________________450', |
||||
'______________________________________________500', |
'______________________________________________500', |
||||
'______________________________________________550', |
'______________________________________________550', |
||||
'______________________________________________600', |
'______________________________________________600', |
||||
'______________________________________________650', |
'______________________________________________650', |
||||
'______________________________________________700', |
'______________________________________________700', |
||||
'______________________________________________750', |
'______________________________________________750', |
||||
'______________________________________________800', |
'______________________________________________800', |
||||
'______________________________________________850', |
'______________________________________________850', |
||||
'______________________________________________900', |
'______________________________________________900', |
||||
'______________________________________________950', |
'______________________________________________950', |
||||
'_____________________________________________1000', |
'_____________________________________________1000', |
||||
'_____________________________________________1050', |
'_____________________________________________1050', |
||||
'_____________________________________________1100', |
'_____________________________________________1100', |
||||
'_____________________________________________1150', |
'_____________________________________________1150', |
||||
'_____________________________________________1200', |
'_____________________________________________1200', |
||||
'_____________________________________________1250', |
'_____________________________________________1250', |
||||
'_____________________________________________1300', |
'_____________________________________________1300', |
||||
'_____________________________________________1350', |
'_____________________________________________1350', |
||||
'_____________________________________________1400', |
'_____________________________________________1400', |
||||
'_____________________________________________1450', |
'_____________________________________________1450', |
||||
'_____________________________________________1500', |
'_____________________________________________1500', |
||||
'_____________________________________________1550', |
'_____________________________________________1550', |
||||
'_____________________________________________1600', |
'_____________________________________________1600', |
||||
'_____________________________________________1650', |
'_____________________________________________1650', |
||||
'_____________________________________________1700', |
'_____________________________________________1700', |
||||
'_____________________________________________1750', |
'_____________________________________________1750', |
||||
'_____________________________________________1800', |
'_____________________________________________1800', |
||||
'_____________________________________________1850', |
'_____________________________________________1850', |
||||
'_____________________________________________1900', |
'_____________________________________________1900', |
||||
'_____________________________________________1950', |
'_____________________________________________1950', |
||||
'_____________________________________________2000', |
'_____________________________________________2000', |
||||
'_____________________________________________2050', |
'_____________________________________________2050', |
||||
'_____________________________________________2100', |
'_____________________________________________2100' |
||||
].join('\n')); |
].join('\n')); |
||||
|
|
||||
|
@ -1,4 +1,4 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
|
|
||||
console.log('hello world'); |
console.log('hello world'); |
||||
|
@ -1,32 +1,32 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
var i; |
var i; |
||||
|
|
||||
var N = 30; |
var N = 30; |
||||
var done = []; |
var done = []; |
||||
|
|
||||
function get_printer(timeout) { |
function get_printer(timeout) { |
||||
return function () { |
return function() { |
||||
console.log("Running from setTimeout " + timeout); |
console.log('Running from setTimeout ' + timeout); |
||||
done.push(timeout); |
done.push(timeout); |
||||
}; |
}; |
||||
} |
} |
||||
|
|
||||
process.nextTick(function () { |
process.nextTick(function() { |
||||
console.log("Running from nextTick"); |
console.log('Running from nextTick'); |
||||
done.push('nextTick'); |
done.push('nextTick'); |
||||
}) |
}); |
||||
|
|
||||
for (i = 0; i < N; i += 1) { |
for (i = 0; i < N; i += 1) { |
||||
setTimeout(get_printer(i), i); |
setTimeout(get_printer(i), i); |
||||
} |
} |
||||
|
|
||||
console.log("Running from main."); |
console.log('Running from main.'); |
||||
|
|
||||
|
|
||||
process.addListener('exit', function () { |
process.addListener('exit', function() { |
||||
assert.equal('nextTick', done[0]); |
assert.equal('nextTick', done[0]); |
||||
for (i = 0; i < N; i += 1) { |
for (i = 0; i < N; i += 1) { |
||||
assert.equal(i, done[i+1]); |
assert.equal(i, done[i + 1]); |
||||
} |
} |
||||
}); |
}); |
||||
|
@ -1,32 +1,32 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
|
|
||||
var childKilled = false, done = false, |
var childKilled = false, done = false, |
||||
spawn = require('child_process').spawn, |
spawn = require('child_process').spawn, |
||||
util = require("util"), |
util = require('util'), |
||||
child; |
child; |
||||
|
|
||||
var join = require('path').join; |
var join = require('path').join; |
||||
|
|
||||
child = spawn(process.argv[0], [join(common.fixturesDir, 'should_exit.js')]); |
child = spawn(process.argv[0], [join(common.fixturesDir, 'should_exit.js')]); |
||||
child.addListener('exit', function () { |
child.addListener('exit', function() { |
||||
if (!done) childKilled = true; |
if (!done) childKilled = true; |
||||
}); |
}); |
||||
|
|
||||
setTimeout(function () { |
setTimeout(function() { |
||||
console.log("Sending SIGINT"); |
console.log('Sending SIGINT'); |
||||
child.kill("SIGINT"); |
child.kill('SIGINT'); |
||||
setTimeout(function () { |
setTimeout(function() { |
||||
console.log("Chance has been given to die"); |
console.log('Chance has been given to die'); |
||||
done = true; |
done = true; |
||||
if (!childKilled) { |
if (!childKilled) { |
||||
// Cleanup
|
// Cleanup
|
||||
console.log("Child did not die on SIGINT, sending SIGTERM"); |
console.log('Child did not die on SIGINT, sending SIGTERM'); |
||||
child.kill("SIGTERM"); |
child.kill('SIGTERM'); |
||||
} |
} |
||||
}, 200); |
}, 200); |
||||
}, 200); |
}, 200); |
||||
|
|
||||
process.addListener("exit", function () { |
process.addListener('exit', function() { |
||||
assert.ok(childKilled); |
assert.ok(childKilled); |
||||
}); |
}); |
||||
|
@ -1,8 +1,8 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
var path = require('path'); |
var path = require('path'); |
||||
var fs = require('fs'); |
var fs = require('fs'); |
||||
|
|
||||
var fixture = path.join(__dirname, "../fixtures/x.txt"); |
var fixture = path.join(__dirname, '../fixtures/x.txt'); |
||||
|
|
||||
assert.equal("xyz\n", fs.readFileSync(fixture)); |
assert.equal('xyz\n', fs.readFileSync(fixture)); |
||||
|
@ -1,9 +1,9 @@ |
|||||
common = require("../common"); |
common = require('../common'); |
||||
assert = common.assert |
assert = common.assert; |
||||
|
|
||||
// üäö
|
// üäö
|
||||
|
|
||||
console.log("Σὲ γνωρίζω ἀπὸ τὴν κόψη"); |
console.log('Σὲ γνωρίζω ἀπὸ τὴν κόψη'); |
||||
|
|
||||
assert.equal(true, /Hellö Wörld/.test("Hellö Wörld") ); |
assert.equal(true, /Hellö Wörld/.test('Hellö Wörld')); |
||||
|
|
||||
|
Loading…
Reference in new issue