Remove unneeded returns
This commit is contained in:
parent
e63c3c727a
commit
12adaa0570
14 changed files with 773 additions and 826 deletions
|
@ -9,48 +9,45 @@ describe('node feature', function() {
|
|||
var fixtures = path.join(__dirname, 'fixtures');
|
||||
|
||||
describe('child_process', function() {
|
||||
return describe('child_process.fork', function() {
|
||||
describe('child_process.fork', function() {
|
||||
it('works in current process', function(done) {
|
||||
var child;
|
||||
child = child_process.fork(path.join(fixtures, 'module', 'ping.js'));
|
||||
child.on('message', function(msg) {
|
||||
assert.equal(msg, 'message');
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
|
||||
it('preserves args', function(done) {
|
||||
var args, child;
|
||||
args = ['--expose_gc', '-test', '1'];
|
||||
child = child_process.fork(path.join(fixtures, 'module', 'process_args.js'), args);
|
||||
var args = ['--expose_gc', '-test', '1'];
|
||||
var child = child_process.fork(path.join(fixtures, 'module', 'process_args.js'), args);
|
||||
child.on('message', function(msg) {
|
||||
assert.deepEqual(args, msg.slice(2));
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
|
||||
it('works in forked process', function(done) {
|
||||
var child;
|
||||
child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'));
|
||||
var child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'));
|
||||
child.on('message', function(msg) {
|
||||
assert.equal(msg, 'message');
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
|
||||
it('works in forked process when options.env is specifed', function(done) {
|
||||
var child;
|
||||
child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'), [], {
|
||||
var child = child_process.fork(path.join(fixtures, 'module', 'fork_ping.js'), [], {
|
||||
path: process.env['PATH']
|
||||
});
|
||||
child.on('message', function(msg) {
|
||||
assert.equal(msg, 'message');
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
|
||||
it('works in browser process', function(done) {
|
||||
|
@ -59,9 +56,9 @@ describe('node feature', function() {
|
|||
child = fork(path.join(fixtures, 'module', 'ping.js'));
|
||||
child.on('message', function(msg) {
|
||||
assert.equal(msg, 'message');
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
|
||||
it('has String::localeCompare working in script', function(done) {
|
||||
|
@ -69,19 +66,18 @@ describe('node feature', function() {
|
|||
child = child_process.fork(path.join(fixtures, 'module', 'locale-compare.js'));
|
||||
child.on('message', function(msg) {
|
||||
assert.deepEqual(msg, [0, -1, 1]);
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
|
||||
return it('has setImmediate working in script', function(done) {
|
||||
var child;
|
||||
child = child_process.fork(path.join(fixtures, 'module', 'set-immediate.js'));
|
||||
it('has setImmediate working in script', function(done) {
|
||||
var child = child_process.fork(path.join(fixtures, 'module', 'set-immediate.js'));
|
||||
child.on('message', function(msg) {
|
||||
assert.equal(msg, 'ok');
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return child.send('message');
|
||||
child.send('message');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -92,18 +88,17 @@ describe('node feature', function() {
|
|||
return;
|
||||
}
|
||||
|
||||
return it('does not crash', function(done) {
|
||||
return fs.readFile(__filename, function() {
|
||||
return setTimeout(done, 0);
|
||||
it('does not crash', function(done) {
|
||||
fs.readFile(__filename, function() {
|
||||
setTimeout(done, 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('throw error in node context', function() {
|
||||
return it('gets caught', function(done) {
|
||||
var error, lsts;
|
||||
error = new Error('boo!');
|
||||
lsts = process.listeners('uncaughtException');
|
||||
it('gets caught', function(done) {
|
||||
var error = new Error('boo!');
|
||||
var lsts = process.listeners('uncaughtException');
|
||||
process.removeAllListeners('uncaughtException');
|
||||
process.on('uncaughtException', function() {
|
||||
var i, len, lst;
|
||||
|
@ -112,28 +107,28 @@ describe('node feature', function() {
|
|||
lst = lsts[i];
|
||||
process.on('uncaughtException', lst);
|
||||
}
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
return fs.readFile(__filename, function() {
|
||||
fs.readFile(__filename, function() {
|
||||
throw error;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('setTimeout called under Chromium event loop in browser process', function() {
|
||||
return it('can be scheduled in time', function(done) {
|
||||
return remote.getGlobal('setTimeout')(done, 0);
|
||||
it('can be scheduled in time', function(done) {
|
||||
remote.getGlobal('setTimeout')(done, 0);
|
||||
});
|
||||
});
|
||||
|
||||
return describe('setInterval called under Chromium event loop in browser process', function() {
|
||||
return it('can be scheduled in time', function(done) {
|
||||
describe('setInterval called under Chromium event loop in browser process', function() {
|
||||
it('can be scheduled in time', function(done) {
|
||||
var clear, interval;
|
||||
clear = function() {
|
||||
remote.getGlobal('clearInterval')(interval);
|
||||
return done();
|
||||
done();
|
||||
};
|
||||
return interval = remote.getGlobal('setInterval')(clear, 10);
|
||||
interval = remote.getGlobal('setInterval')(clear, 10);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -141,27 +136,27 @@ describe('node feature', function() {
|
|||
describe('message loop', function() {
|
||||
describe('process.nextTick', function() {
|
||||
it('emits the callback', function(done) {
|
||||
return process.nextTick(done);
|
||||
process.nextTick(done);
|
||||
});
|
||||
|
||||
return it('works in nested calls', function(done) {
|
||||
return process.nextTick(function() {
|
||||
return process.nextTick(function() {
|
||||
return process.nextTick(done);
|
||||
it('works in nested calls', function(done) {
|
||||
process.nextTick(function() {
|
||||
process.nextTick(function() {
|
||||
process.nextTick(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return describe('setImmediate', function() {
|
||||
describe('setImmediate', function() {
|
||||
it('emits the callback', function(done) {
|
||||
return setImmediate(done);
|
||||
setImmediate(done);
|
||||
});
|
||||
|
||||
return it('works in nested calls', function(done) {
|
||||
return setImmediate(function() {
|
||||
return setImmediate(function() {
|
||||
return setImmediate(done);
|
||||
it('works in nested calls', function(done) {
|
||||
setImmediate(function() {
|
||||
setImmediate(function() {
|
||||
setImmediate(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -173,18 +168,18 @@ describe('node feature', function() {
|
|||
return;
|
||||
}
|
||||
|
||||
return it('emit error when connect to a socket path without listeners', function(done) {
|
||||
it('emit error when connect to a socket path without listeners', function(done) {
|
||||
var child, script, socketPath;
|
||||
socketPath = path.join(os.tmpdir(), 'atom-shell-test.sock');
|
||||
script = path.join(fixtures, 'module', 'create_socket.js');
|
||||
child = child_process.fork(script, [socketPath]);
|
||||
return child.on('exit', function(code) {
|
||||
child.on('exit', function(code) {
|
||||
var client;
|
||||
assert.equal(code, 0);
|
||||
client = require('net').connect(socketPath);
|
||||
return client.on('error', function(error) {
|
||||
client.on('error', function(error) {
|
||||
assert.equal(error.code, 'ECONNREFUSED');
|
||||
return done();
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -197,16 +192,16 @@ describe('node feature', function() {
|
|||
p.innerText = '闲云潭影日悠悠,物换星移几度秋';
|
||||
b = new Buffer(p.innerText);
|
||||
assert.equal(b.toString(), '闲云潭影日悠悠,物换星移几度秋');
|
||||
return assert.equal(Buffer.byteLength(p.innerText), 45);
|
||||
assert.equal(Buffer.byteLength(p.innerText), 45);
|
||||
});
|
||||
|
||||
return it('correctly parses external one-byte UTF8 string', function() {
|
||||
it('correctly parses external one-byte UTF8 string', function() {
|
||||
var b, p;
|
||||
p = document.createElement('p');
|
||||
p.innerText = 'Jøhänñéß';
|
||||
b = new Buffer(p.innerText);
|
||||
assert.equal(b.toString(), 'Jøhänñéß');
|
||||
return assert.equal(Buffer.byteLength(p.innerText), 13);
|
||||
assert.equal(Buffer.byteLength(p.innerText), 13);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue