11'use strict' ;
2- require ( '../common' ) ;
2+ const common = require ( '../common' ) ;
33const Readable = require ( '_stream_readable' ) ;
44const Writable = require ( '_stream_writable' ) ;
55const assert = require ( 'assert' ) ;
@@ -54,7 +54,7 @@ function toArray(callback) {
5454
5555function fromArray ( list ) {
5656 const r = new Readable ( { objectMode : true } ) ;
57- r . _read = noop ;
57+ r . _read = common . mustNotCall ( ) ;
5858 list . forEach ( function ( chunk ) {
5959 r . push ( chunk ) ;
6060 } ) ;
@@ -63,8 +63,6 @@ function fromArray(list) {
6363 return r ;
6464}
6565
66- function noop ( ) { }
67-
6866test ( 'can read objects from stream' , function ( t ) {
6967 const r = fromArray ( [ { one : '1' } , { two : '2' } ] ) ;
7068
@@ -144,7 +142,7 @@ test('can read strings as objects', function(t) {
144142 const r = new Readable ( {
145143 objectMode : true
146144 } ) ;
147- r . _read = noop ;
145+ r . _read = common . mustNotCall ( ) ;
148146 const list = [ 'one' , 'two' , 'three' ] ;
149147 list . forEach ( function ( str ) {
150148 r . push ( str ) ;
@@ -162,7 +160,7 @@ test('read(0) for object streams', function(t) {
162160 const r = new Readable ( {
163161 objectMode : true
164162 } ) ;
165- r . _read = noop ;
163+ r . _read = common . mustNotCall ( ) ;
166164
167165 r . push ( 'foobar' ) ;
168166 r . push ( null ) ;
@@ -178,7 +176,7 @@ test('falsey values', function(t) {
178176 const r = new Readable ( {
179177 objectMode : true
180178 } ) ;
181- r . _read = noop ;
179+ r . _read = common . mustNotCall ( ) ;
182180
183181 r . push ( false ) ;
184182 r . push ( 0 ) ;
@@ -229,7 +227,7 @@ test('high watermark push', function(t) {
229227 highWaterMark : 6 ,
230228 objectMode : true
231229 } ) ;
232- r . _read = function ( n ) { } ;
230+ r . _read = common . mustNotCall ( ) ;
233231 for ( let i = 0 ; i < 6 ; i ++ ) {
234232 const bool = r . push ( i ) ;
235233 assert . strictEqual ( bool , i !== 5 ) ;
0 commit comments