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.A = function () { |
|||
exports.A = function() { |
|||
return string; |
|||
}; |
|||
|
|||
exports.C = function () { |
|||
exports.C = function() { |
|||
return c.C(); |
|||
}; |
|||
|
|||
exports.D = function () { |
|||
exports.D = function() { |
|||
return c.D(); |
|||
}; |
|||
|
|||
exports.number = 42; |
|||
|
|||
process.addListener("exit", function () { |
|||
string = "A done"; |
|||
process.addListener('exit', function() { |
|||
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.C = function () { |
|||
exports.C = function() { |
|||
return string; |
|||
}; |
|||
|
|||
exports.D = function () { |
|||
exports.D = function() { |
|||
return d.D(); |
|||
}; |
|||
|
|||
process.addListener("exit", function () { |
|||
string = "C done"; |
|||
console.log("b/c.js exit"); |
|||
process.addListener('exit', function() { |
|||
string = 'C done'; |
|||
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; |
|||
}; |
|||
|
|||
process.addListener("exit", function () { |
|||
string = "D done"; |
|||
process.addListener('exit', function() { |
|||
string = 'D done'; |
|||
}); |
|||
|
|||
|
@ -1,2 +1,2 @@ |
|||
exports.hello = "world"; |
|||
common.debug("load package/index.js"); |
|||
exports.hello = 'world'; |
|||
common.debug('load package/index.js'); |
|||
|
@ -1,6 +1,6 @@ |
|||
|
|||
var root = require("./../root"); |
|||
var root = require('./../root'); |
|||
|
|||
exports.hello = function () { |
|||
exports.hello = function() { |
|||
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.sayHello = function () { |
|||
exports.hello = 'hello'; |
|||
exports.sayHello = function() { |
|||
return foo.hello(); |
|||
}; |
|||
exports.calledFromFoo = function () { |
|||
exports.calledFromFoo = function() { |
|||
return exports.hello; |
|||
}; |
|||
|
@ -1,14 +1,14 @@ |
|||
common = require("../common"); |
|||
common = require('../common'); |
|||
assert = common.assert; |
|||
|
|||
common.print("hello world\r\n"); |
|||
common.print('hello world\r\n'); |
|||
|
|||
var stdin = process.openStdin(); |
|||
|
|||
stdin.addListener("data", function (data) { |
|||
stdin.addListener('data', function(data) { |
|||
process.stdout.write(data.toString()); |
|||
}); |
|||
|
|||
stdin.addListener("end", function () { |
|||
stdin.addListener('end', function() { |
|||
process.stdout.end(); |
|||
}); |
|||
|
@ -1,4 +1,4 @@ |
|||
foo = "foo"; |
|||
global.bar = "bar"; |
|||
foo = 'foo'; |
|||
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")); |
|||
net = require("net"); |
|||
process.mixin(require('../common')); |
|||
net = require('net'); |
|||
|
|||
path = process.ARGV[2]; |
|||
greeting = process.ARGV[3]; |
|||
|
|||
receiver = net.createServer(function(socket) { |
|||
socket.addListener("fd", function(fd) { |
|||
socket.addListener('fd', function(fd) { |
|||
var peerInfo = process.getpeername(fd); |
|||
peerInfo.fd = fd; |
|||
var passedSocket = new net.Socket(peerInfo); |
|||
|
|||
passedSocket.addListener("eof", function() { |
|||
passedSocket.addListener('eof', function() { |
|||
passedSocket.close(); |
|||
}); |
|||
|
|||
passedSocket.addListener("data", function(data) { |
|||
passedSocket.send("[echo] " + data); |
|||
passedSocket.addListener('data', function(data) { |
|||
passedSocket.send('[echo] ' + data); |
|||
}); |
|||
passedSocket.addListener("close", function() { |
|||
passedSocket.addListener('close', function() { |
|||
receiver.close(); |
|||
}); |
|||
passedSocket.send("[greeting] " + greeting); |
|||
passedSocket.send('[greeting] ' + greeting); |
|||
}); |
|||
}); |
|||
|
|||
/* To signal the test runne we're up and listening */ |
|||
receiver.addListener("listening", function() { |
|||
common.print("ready"); |
|||
receiver.addListener('listening', function() { |
|||
common.print('ready'); |
|||
}); |
|||
|
|||
receiver.listen(path); |
|||
|
@ -1,10 +1,12 @@ |
|||
common = require("../common"); |
|||
assert = common.assert |
|||
Buffer = require("buffer").Buffer; |
|||
common = require('../common'); |
|||
assert = common.assert; |
|||
Buffer = require('buffer').Buffer; |
|||
|
|||
var n = parseInt(process.argv[2]); |
|||
|
|||
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); |
|||
|
@ -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; |
|||
|
@ -1,2 +1,2 @@ |
|||
require.paths.unshift(__dirname); |
|||
exports.bar = require("bar"); |
|||
exports.bar = require('bar'); |
|||
|
@ -1,2 +1,2 @@ |
|||
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() {} |
|||
process.addListener("SIGINT", tmp); |
|||
process.removeListener("SIGINT", tmp); |
|||
setInterval(function () { |
|||
process.addListener('SIGINT', tmp); |
|||
process.removeListener('SIGINT', tmp); |
|||
setInterval(function() { |
|||
process.stdout.write('keep alive\n'); |
|||
}, 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); |
|||
}); |
|||
|
@ -1,4 +1,4 @@ |
|||
common = require("../common"); |
|||
assert = common.assert |
|||
common = require('../common'); |
|||
assert = common.assert; |
|||
|
|||
console.log('hello world'); |
|||
|
@ -1,32 +1,32 @@ |
|||
common = require("../common"); |
|||
assert = common.assert |
|||
common = require('../common'); |
|||
assert = common.assert; |
|||
var i; |
|||
|
|||
var N = 30; |
|||
var done = []; |
|||
|
|||
function get_printer(timeout) { |
|||
return function () { |
|||
console.log("Running from setTimeout " + timeout); |
|||
return function() { |
|||
console.log('Running from setTimeout ' + timeout); |
|||
done.push(timeout); |
|||
}; |
|||
} |
|||
|
|||
process.nextTick(function () { |
|||
console.log("Running from nextTick"); |
|||
process.nextTick(function() { |
|||
console.log('Running from nextTick'); |
|||
done.push('nextTick'); |
|||
}) |
|||
}); |
|||
|
|||
for (i = 0; i < N; i += 1) { |
|||
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]); |
|||
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"); |
|||
assert = common.assert |
|||
common = require('../common'); |
|||
assert = common.assert; |
|||
|
|||
var childKilled = false, done = false, |
|||
spawn = require('child_process').spawn, |
|||
util = require("util"), |
|||
util = require('util'), |
|||
child; |
|||
|
|||
var join = require('path').join; |
|||
|
|||
child = spawn(process.argv[0], [join(common.fixturesDir, 'should_exit.js')]); |
|||
child.addListener('exit', function () { |
|||
child.addListener('exit', function() { |
|||
if (!done) childKilled = true; |
|||
}); |
|||
|
|||
setTimeout(function () { |
|||
console.log("Sending SIGINT"); |
|||
child.kill("SIGINT"); |
|||
setTimeout(function () { |
|||
console.log("Chance has been given to die"); |
|||
setTimeout(function() { |
|||
console.log('Sending SIGINT'); |
|||
child.kill('SIGINT'); |
|||
setTimeout(function() { |
|||
console.log('Chance has been given to die'); |
|||
done = true; |
|||
if (!childKilled) { |
|||
// Cleanup
|
|||
console.log("Child did not die on SIGINT, sending SIGTERM"); |
|||
child.kill("SIGTERM"); |
|||
console.log('Child did not die on SIGINT, sending SIGTERM'); |
|||
child.kill('SIGTERM'); |
|||
} |
|||
}, 200); |
|||
}, 200); |
|||
|
|||
process.addListener("exit", function () { |
|||
process.addListener('exit', function() { |
|||
assert.ok(childKilled); |
|||
}); |
|||
|
@ -1,8 +1,8 @@ |
|||
common = require("../common"); |
|||
assert = common.assert |
|||
common = require('../common'); |
|||
assert = common.assert; |
|||
var path = require('path'); |
|||
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"); |
|||
assert = common.assert |
|||
common = require('../common'); |
|||
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