mirror of https://github.com/lukechilds/node.git
Browse Source
Export a new common.noop no-operation function for general use. Allow using common.mustCall() without a fn argument to simplify test cases. Replace various non-op functions throughout tests with common.noop PR-URL: https://github.com/nodejs/node/pull/12027 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>v6
James M Snell
8 years ago
184 changed files with 492 additions and 490 deletions
@ -1,5 +1,5 @@ |
|||
// Flags: --trace-warnings
|
|||
'use strict'; |
|||
require('../common'); |
|||
const common = require('../common'); |
|||
const p = Promise.reject(new Error('This was rejected')); |
|||
setImmediate(() => p.catch(() => {})); |
|||
setImmediate(() => p.catch(common.noop)); |
|||
|
@ -1,9 +1,10 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const fs = require('fs'); |
|||
|
|||
const watch = fs.watchFile(__filename, () => {}); |
|||
const watch = fs.watchFile(__filename, common.noop); |
|||
watch.once('stop', assert.fail); // Should not trigger.
|
|||
watch.stop(); |
|||
watch.removeListener('stop', assert.fail); |
|||
|
@ -1,24 +1,23 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
const ClientRequest = require('http').ClientRequest; |
|||
|
|||
function noop() {} |
|||
|
|||
{ |
|||
const req = new ClientRequest({ createConnection: noop }); |
|||
const req = new ClientRequest({ createConnection: common.noop }); |
|||
assert.strictEqual(req.path, '/'); |
|||
assert.strictEqual(req.method, 'GET'); |
|||
} |
|||
|
|||
{ |
|||
const req = new ClientRequest({ method: '', createConnection: noop }); |
|||
const req = new ClientRequest({ method: '', createConnection: common.noop }); |
|||
assert.strictEqual(req.path, '/'); |
|||
assert.strictEqual(req.method, 'GET'); |
|||
} |
|||
|
|||
{ |
|||
const req = new ClientRequest({ path: '', createConnection: noop }); |
|||
const req = new ClientRequest({ path: '', createConnection: common.noop }); |
|||
assert.strictEqual(req.path, '/'); |
|||
assert.strictEqual(req.method, 'GET'); |
|||
} |
|||
|
@ -1,10 +1,11 @@ |
|||
'use strict'; |
|||
require('../common'); |
|||
|
|||
const common = require('../common'); |
|||
const assert = require('assert'); |
|||
|
|||
|
|||
// Regression test for instanceof, see
|
|||
// https://github.com/nodejs/node/issues/7592
|
|||
const F = () => {}; |
|||
const F = common.noop; |
|||
F.prototype = {}; |
|||
assert(Object.create(F.prototype) instanceof F); |
|||
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue