@@ -14,7 +14,7 @@ async function tests() {
1414AsyncIteratorPrototype ) ;
1515}
1616
17- await ( async function ( ) {
17+ {
1818const readable = new Readable ( { objectMode : true , read ( ) { } } ) ;
1919readable . push ( 0 ) ;
2020readable . push ( 1 ) ;
@@ -25,9 +25,9 @@ async function tests() {
2525for await ( const d of iter ) {
2626assert . strictEqual ( d , 1 ) ;
2727}
28- } ) ( ) ;
28+ }
2929
30- await ( async function ( ) {
30+ {
3131console . log ( 'read without for..await' ) ;
3232const max = 5 ;
3333const readable = new Readable ( {
@@ -55,9 +55,9 @@ async function tests() {
5555
5656const last = await iter . next ( ) ;
5757assert . strictEqual ( last . done , true ) ;
58- } ) ( ) ;
58+ }
5959
60- await ( async function ( ) {
60+ {
6161console . log ( 'read without for..await deferred' ) ;
6262const readable = new Readable ( {
6363objectMode : true ,
@@ -95,9 +95,9 @@ async function tests() {
9595
9696const last = await iter . next ( ) ;
9797assert . strictEqual ( last . done , true ) ;
98- } ) ( ) ;
98+ }
9999
100- await ( async function ( ) {
100+ {
101101console . log ( 'read without for..await with errors' ) ;
102102const max = 3 ;
103103const readable = new Readable ( {
@@ -133,9 +133,9 @@ async function tests() {
133133} ) ;
134134
135135readable . destroy ( new Error ( 'kaboom' ) ) ;
136- } ) ( ) ;
136+ }
137137
138- await ( async function ( ) {
138+ {
139139console . log ( 'call next() after error' ) ;
140140const readable = new Readable ( {
141141read ( ) { }
@@ -145,9 +145,9 @@ async function tests() {
145145const err = new Error ( 'kaboom' ) ;
146146readable . destroy ( new Error ( 'kaboom' ) ) ;
147147await assert . rejects ( iterator . next . bind ( iterator ) , err ) ;
148- } ) ( ) ;
148+ }
149149
150- await ( async function ( ) {
150+ {
151151console . log ( 'read object mode' ) ;
152152const max = 42 ;
153153let readed = 0 ;
@@ -168,9 +168,9 @@ async function tests() {
168168}
169169
170170assert . strictEqual ( readed , received ) ;
171- } ) ( ) ;
171+ }
172172
173- await ( async function ( ) {
173+ {
174174console . log ( 'destroy sync' ) ;
175175const readable = new Readable ( {
176176objectMode : true ,
@@ -187,9 +187,9 @@ async function tests() {
187187err = e ;
188188}
189189assert . strictEqual ( err . message , 'kaboom from read' ) ;
190- } ) ( ) ;
190+ }
191191
192- await ( async function ( ) {
192+ {
193193console . log ( 'destroy async' ) ;
194194const readable = new Readable ( {
195195objectMode : true ,
@@ -219,9 +219,9 @@ async function tests() {
219219
220220assert . strictEqual ( err . message , 'kaboom' ) ;
221221assert . strictEqual ( received , 1 ) ;
222- } ) ( ) ;
222+ }
223223
224- await ( async function ( ) {
224+ {
225225console . log ( 'destroyed by throw' ) ;
226226const readable = new Readable ( {
227227objectMode : true ,
@@ -242,9 +242,9 @@ async function tests() {
242242
243243assert . strictEqual ( err . message , 'kaboom' ) ;
244244assert . strictEqual ( readable . destroyed , true ) ;
245- } ) ( ) ;
245+ }
246246
247- await ( async function ( ) {
247+ {
248248console . log ( 'destroyed sync after push' ) ;
249249const readable = new Readable ( {
250250objectMode : true ,
@@ -268,9 +268,9 @@ async function tests() {
268268
269269assert . strictEqual ( err . message , 'kaboom' ) ;
270270assert . strictEqual ( received , 1 ) ;
271- } ) ( ) ;
271+ }
272272
273- await ( async function ( ) {
273+ {
274274console . log ( 'push async' ) ;
275275const max = 42 ;
276276let readed = 0 ;
@@ -293,9 +293,9 @@ async function tests() {
293293}
294294
295295assert . strictEqual ( readed , received ) ;
296- } ) ( ) ;
296+ }
297297
298- await ( async function ( ) {
298+ {
299299console . log ( 'push binary async' ) ;
300300const max = 42 ;
301301let readed = 0 ;
@@ -323,9 +323,9 @@ async function tests() {
323323}
324324
325325assert . strictEqual ( data , expected ) ;
326- } ) ( ) ;
326+ }
327327
328- await ( async function ( ) {
328+ {
329329console . log ( '.next() on destroyed stream' ) ;
330330const readable = new Readable ( {
331331read ( ) {
@@ -337,9 +337,9 @@ async function tests() {
337337
338338const { done } = await readable [ Symbol . asyncIterator ] ( ) . next ( ) ;
339339assert . strictEqual ( done , true ) ;
340- } ) ( ) ;
340+ }
341341
342- await ( async function ( ) {
342+ {
343343console . log ( '.next() on pipelined stream' ) ;
344344const readable = new Readable ( {
345345read ( ) {
@@ -358,9 +358,9 @@ async function tests() {
358358} catch ( e ) {
359359assert . strictEqual ( e , err ) ;
360360}
361- } ) ( ) ;
361+ }
362362
363- await ( async ( ) => {
363+ {
364364console . log ( 'iterating on an ended stream completes' ) ;
365365const r = new Readable ( {
366366objectMode : true ,
@@ -376,9 +376,9 @@ async function tests() {
376376// eslint-disable-next-line no-unused-vars
377377for await ( const b of r ) {
378378}
379- } ) ( ) ;
379+ }
380380
381- await ( async ( ) => {
381+ {
382382console . log ( 'destroy mid-stream does not error' ) ;
383383const r = new Readable ( {
384384objectMode : true ,
@@ -392,9 +392,9 @@ async function tests() {
392392for await ( const a of r ) {
393393r . destroy ( null ) ;
394394}
395- } ) ( ) ;
395+ }
396396
397- await ( async ( ) => {
397+ {
398398console . log ( 'all next promises must be resolved on end' ) ;
399399const r = new Readable ( {
400400objectMode : true ,
@@ -408,9 +408,9 @@ async function tests() {
408408r . push ( null ) ;
409409assert . deepStrictEqual ( await c , { done : true , value : undefined } ) ;
410410assert . deepStrictEqual ( await d , { done : true , value : undefined } ) ;
411- } ) ( ) ;
411+ }
412412
413- await ( async ( ) => {
413+ {
414414console . log ( 'all next promises must be resolved on destroy' ) ;
415415const r = new Readable ( {
416416objectMode : true ,
@@ -424,9 +424,9 @@ async function tests() {
424424r . destroy ( ) ;
425425assert . deepStrictEqual ( await c , { done : true , value : undefined } ) ;
426426assert . deepStrictEqual ( await d , { done : true , value : undefined } ) ;
427- } ) ( ) ;
427+ }
428428
429- await ( async ( ) => {
429+ {
430430console . log ( 'all next promises must be resolved on destroy with error' ) ;
431431const r = new Readable ( {
432432objectMode : true ,
@@ -457,7 +457,7 @@ async function tests() {
457457}
458458assert . strictEqual ( e , err ) ;
459459} ) ( ) ] ) ;
460- } ) ( ) ;
460+ }
461461}
462462
463463// to avoid missing some tests if a promise does not resolve
0 commit comments