Skip to content

Commit

Permalink
test: use mustNotCall() in test-stream2-objects
Browse files Browse the repository at this point in the history
Use `common.mustNotCall()` in test-stream2-objects.js to confirm that
noop function is never invoked.

PR-URL: #13249
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and jasnell committed Jun 5, 2017
1 parent 5369359 commit ec357bf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-stream2-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function toArray(callback) {

function fromArray(list) {
const r = new Readable({ objectMode: true });
r._read = common.noop;
r._read = common.mustNotCall();
list.forEach(function(chunk) {
r.push(chunk);
});
Expand Down Expand Up @@ -164,7 +164,7 @@ test('can read strings as objects', function(t) {
const r = new Readable({
objectMode: true
});
r._read = common.noop;
r._read = common.mustNotCall();
const list = ['one', 'two', 'three'];
list.forEach(function(str) {
r.push(str);
Expand All @@ -182,7 +182,7 @@ test('read(0) for object streams', function(t) {
const r = new Readable({
objectMode: true
});
r._read = common.noop;
r._read = common.mustNotCall();

r.push('foobar');
r.push(null);
Expand All @@ -198,7 +198,7 @@ test('falsey values', function(t) {
const r = new Readable({
objectMode: true
});
r._read = common.noop;
r._read = common.mustNotCall();

r.push(false);
r.push(0);
Expand Down Expand Up @@ -249,7 +249,7 @@ test('high watermark push', function(t) {
highWaterMark: 6,
objectMode: true
});
r._read = common.noop;
r._read = common.mustNotCall();
for (let i = 0; i < 6; i++) {
const bool = r.push(i);
assert.strictEqual(bool, i !== 5);
Expand Down

0 comments on commit ec357bf

Please sign in to comment.