aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-stream2-writable.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-03-24 09:46:44 -0700
committerJames M Snell <jasnell@gmail.com>2017-03-26 12:47:15 -0700
commit4f2e372716714ed030cb5ba6e67107b913f15343 (patch)
tree9b86be4f904c7844c48cca4194f3c3a5a1decad8 /test/parallel/test-stream2-writable.js
parentd13bd4acc0b60191f0d6e9fae92087242d04dfbd (diff)
downloadandroid-node-v8-4f2e372716714ed030cb5ba6e67107b913f15343.tar.gz
android-node-v8-4f2e372716714ed030cb5ba6e67107b913f15343.tar.bz2
android-node-v8-4f2e372716714ed030cb5ba6e67107b913f15343.zip
test: add common.noop, default for common.mustCall()
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>
Diffstat (limited to 'test/parallel/test-stream2-writable.js')
-rw-r--r--test/parallel/test-stream2-writable.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js
index 5aefe624a4..c983a26c40 100644
--- a/test/parallel/test-stream2-writable.js
+++ b/test/parallel/test-stream2-writable.js
@@ -20,7 +20,8 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.
'use strict';
-require('../common');
+
+const common = require('../common');
const W = require('_stream_writable');
const D = require('_stream_duplex');
const assert = require('assert');
@@ -304,7 +305,7 @@ test('encoding should be ignored for buffers', function(t) {
test('writables are not pipable', function(t) {
const w = new W();
- w._write = function() {};
+ w._write = common.noop;
let gotError = false;
w.on('error', function() {
gotError = true;
@@ -316,8 +317,8 @@ test('writables are not pipable', function(t) {
test('duplexes are pipable', function(t) {
const d = new D();
- d._read = function() {};
- d._write = function() {};
+ d._read = common.noop;
+ d._write = common.noop;
let gotError = false;
d.on('error', function() {
gotError = true;
@@ -329,7 +330,7 @@ test('duplexes are pipable', function(t) {
test('end(chunk) two times is an error', function(t) {
const w = new W();
- w._write = function() {};
+ w._write = common.noop;
let gotError = false;
w.on('error', function(er) {
gotError = true;