ide на основе vs code · VibeGit
ide на основе vs code Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
krutaya-ide-na-osnove-vs-code / src / vs / base / test / common / stream.test.ts 619 строк · изменён 14 нояб., 04:52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
import assert from 'assert' ;
import { timeout } from '../../common/async.js' ;
import { ensureNoDisposablesAreLeakedInTestSuite } from './utils.js' ;
import { bufferToReadable, VSBuffer } from '../../common/buffer.js' ;
import { CancellationTokenSource } from '../../common/cancellation.js' ;
import { consumeReadable, consumeStream, isReadable, isReadableBufferedStream, isReadableStream, listenStream, newWriteableStream, peekReadable, peekStream, prefixedReadable, prefixedStream, Readable, ReadableStream, toReadable toStream transform
assert
assert Object
assert VSBuffer
assert
assert Object
assert d d
assert Object
stream d d
stream
bufferedStream stream
assert bufferedStream
stream strings strings
error
stream e
error
end
stream
end
stream
chunks
stream data
chunks data
assert chunks
stream
assert chunks
assert error
assert end
stream
stream
stream
stream
assert chunks length
stream
assert chunks length
assert chunks
stream
assert error
error
stream
assert error
stream
assert chunks length
assert chunks
assert end
stream
stream
assert chunks length
value
stream
error
stream e
error
end
stream
end
stream
chunks TestMessage
stream data
chunks data
chunks
assert chunks value
stream
chunks
assert chunks value
assert error
assert end
stream
stream
stream
stream
assert chunks length
stream
assert chunks length
chunks
assert chunks value
chunks
assert chunks value
chunks
assert chunks value
stream
assert error
error
stream
assert error
stream
assert chunks length
chunks
assert chunks value
assert end
stream
stream
assert chunks length
strings strings length strings
stream reducer
stream
result stream reducer
assert result
errors Error errors
stream reducer
stream
result stream reducer
assert result
stream strings strings
error
e Error
error
stream errorListener
data
data
stream dataListener
stream
assert data
data
stream dataListener
stream
assert data
stream
assert error
error
stream errorListener
stream
stream
assert error
stream strings strings highWaterMark
res stream
assert res
res stream
assert res
res stream
assert res
promise1 stream
assert promise1
promise2 stream
assert promise2
drained1
promise1
drained1
drained2
promise2
drained2
data
stream chunk
data chunk
assert data
assert drained1
assert drained2
readable
consumed readable strings strings
assert consumed
i i i
readable
consumedOrReadable readable strings strings i
consumedOrReadable
assert
consumed consumedOrReadable strings strings
assert consumed
readable
consumedOrReadable readable strings strings
assert consumedOrReadable
readable
consumedOrReadable readable strings strings
assert consumedOrReadable
stream data data
error Error
promise
stream
err
error err
stream
promise
assert error
stream data data
error
promise
stream
err
error err
stream
stream
promise
assert error
stream data data
error
promise
stream
err
error err
stream
stream
stream
promise
assert error
stream err error err
stream chunk
assert error
array Readable
array
readable Readable ReadableStream
stream strings strings
chunk
chunk readable
stream chunk
stream
stream
stream
consumed stream strings strings
assert consumed
stream
consumed stream
assert consumed
stream strings strings
stream
consumed stream
assert consumed
stream strings strings
error
end
data
stream
d
data d
e
error
end
stream
assert data
stream
assert data
assert error
assert end
stream
assert error
stream
assert end
stream strings strings
error
end
data
cts
stream
d
data d
e
error
end
cts token
cts
stream
assert data
stream
assert data
stream
assert error
stream
assert end
i i i
stream
result stream i
assert stream result stream
result ended
assert
assert result buffer length i
additionalResult
stream strings
additionalResult strings
strings
assert result buffer additionalResult
stream
result stream
assert stream result stream
assert result buffer
assert result ended
stream
result stream
assert stream result stream
assert result buffer
assert result ended
stream strings strings
consumed stream strings strings
assert consumed
readable
consumed readable strings strings
assert consumed
source strings strings
result source strings strings
source
source
source
source
source
consumed result strings strings
assert consumed
stream strings strings
listener1Called
listener2Called
stream listener1 listener1Called
listener2Called
stream listener1
stream listener2
stream
stream
assert listener1Called
assert listener2Called
readable val val
assert readable val val
readable val val
assert readable val val
stream strings strings
stream
stream
stream
stream
prefixStream stream val val
assert prefixStream val val
stream strings strings
stream
prefixStream stream val val
assert prefixStream val val
stream strings strings
stream
prefixStream stream val val
error
prefixStream val val
e
error e
assert error
,
,
}
from
'../../common/stream.js'
;
suite
(
'Stream'
,
(
)
=>
{
test
(
'isReadable'
,
(
)
=>
{
.
ok
(
!
isReadable
(
undefined
)
)
;
.
ok
(
!
isReadable
(
.
create
(
null
)
)
)
;
.
ok
(
isReadable
(
bufferToReadable
(
.
fromString
(
''
)
)
)
)
;
}
)
;
test
(
'isReadableStream'
,
(
)
=>
{
.
ok
(
!
isReadableStream
(
undefined
)
)
;
.
ok
(
!
isReadableStream
(
.
create
(
null
)
)
)
;
.
ok
(
isReadableStream
(
newWriteableStream
(
=>
)
)
)
;
}
)
;
test
(
'isReadableBufferedStream'
,
async
(
)
=>
{
.
ok
(
!
isReadableBufferedStream
(
.
create
(
null
)
)
)
;
const
=
newWriteableStream
(
=>
)
;
.
end
(
)
;
const
=
await
peekStream
(
,
1
)
;
.
ok
(
isReadableBufferedStream
(
)
)
;
}
)
;
test
(
'WriteableStream - basics'
,
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
let
=
false
;
.
on
(
'error'
,
=>
{
=
true
;
}
)
;
let
=
false
;
.
on
(
'end'
,
(
)
=>
{
=
true
;
}
)
;
.
write
(
'Hello'
)
;
const
:
string
[
]
=
[
]
;
.
on
(
'data'
,
=>
{
.
push
(
)
;
}
)
;
.
strictEqual
(
[
0
]
,
'Hello'
)
;
.
write
(
'World'
)
;
.
strictEqual
(
[
1
]
,
'World'
)
;
.
strictEqual
(
,
false
)
;
.
strictEqual
(
,
false
)
;
.
pause
(
)
;
.
write
(
'1'
)
;
.
write
(
'2'
)
;
.
write
(
'3'
)
;
.
strictEqual
(
.
,
2
)
;
.
resume
(
)
;
.
strictEqual
(
.
,
3
)
;
.
strictEqual
(
[
2
]
,
'1,2,3'
)
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
true
)
;
=
false
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
true
)
;
.
end
(
'Final Bit'
)
;
.
strictEqual
(
.
,
4
)
;
.
strictEqual
(
[
3
]
,
'Final Bit'
)
;
.
strictEqual
(
,
true
)
;
.
destroy
(
)
;
.
write
(
'Unexpected'
)
;
.
strictEqual
(
.
,
4
)
;
}
)
;
test
(
'stream with non-reducible messages'
,
(
)
=>
{
class
TestMessage
{
constructor
(
public
:
string
)
{
}
}
const
=
newWriteableStream < TestMessage>
(
null
)
;
let
=
false
;
.
on
(
'error'
,
=>
{
=
true
;
}
)
;
let
=
false
;
.
on
(
'end'
,
(
)
=>
{
=
true
;
}
)
;
.
write
(
new
TestMessage
(
'Hello'
)
)
;
const
:
[
]
=
[
]
;
.
on
(
'data'
,
=>
{
.
push
(
)
;
}
)
;
assert
(
[
0
]
instanceof
TestMessage
,
'Message `0` must be an instance of `TestMessage`.'
,
)
;
.
strictEqual
(
[
0
]
.
,
'Hello'
)
;
.
write
(
new
TestMessage
(
'World'
)
)
;
assert
(
[
1
]
instanceof
TestMessage
,
'Message `1` must be an instance of `TestMessage`.'
,
)
;
.
strictEqual
(
[
1
]
.
,
'World'
)
;
.
strictEqual
(
,
false
)
;
.
strictEqual
(
,
false
)
;
.
pause
(
)
;
.
write
(
new
TestMessage
(
'1'
)
)
;
.
write
(
new
TestMessage
(
'2'
)
)
;
.
write
(
new
TestMessage
(
'3'
)
)
;
.
strictEqual
(
.
,
2
)
;
.
resume
(
)
;
.
strictEqual
(
.
,
5
)
;
assert
(
[
2
]
instanceof
TestMessage
,
'Message `2` must be an instance of `TestMessage`.'
,
)
;
.
strictEqual
(
[
2
]
.
,
'1'
)
;
assert
(
[
3
]
instanceof
TestMessage
,
'Message `3` must be an instance of `TestMessage`.'
,
)
;
.
strictEqual
(
[
3
]
.
,
'2'
)
;
assert
(
[
4
]
instanceof
TestMessage
,
'Message `4` must be an instance of `TestMessage`.'
,
)
;
.
strictEqual
(
[
4
]
.
,
'3'
)
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
true
)
;
=
false
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
true
)
;
.
end
(
new
TestMessage
(
'Final Bit'
)
)
;
.
strictEqual
(
.
,
6
)
;
assert
(
[
5
]
instanceof
TestMessage
,
'Message `5` must be an instance of `TestMessage`.'
,
)
;
.
strictEqual
(
[
5
]
.
,
'Final Bit'
)
;
.
strictEqual
(
,
true
)
;
.
destroy
(
)
;
.
write
(
new
TestMessage
(
'Unexpected'
)
)
;
.
strictEqual
(
.
,
6
)
;
}
)
;
test
(
'WriteableStream - end with empty string works'
,
async
(
)
=>
{
const
reducer
=
(
:
string
[
]
)
=>
.
>
0
?
.
join
(
)
:
'error'
;
const
=
newWriteableStream < string >
(
)
;
.
end
(
''
)
;
const
=
await
consumeStream
(
,
)
;
.
strictEqual
(
,
''
)
;
}
)
;
test
(
'WriteableStream - end with error works'
,
async
(
)
=>
{
const
reducer
=
(
:
[
]
)
=>
[
0
]
;
const
=
newWriteableStream < Error>
(
)
;
.
end
(
new
Error
(
'error'
)
)
;
const
=
await
consumeStream
(
,
)
;
.
ok
(
instanceof
Error
)
;
}
)
;
test
(
'WriteableStream - removeListener'
,
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
let
=
false
;
const
errorListener
=
(
:
)
=>
{
=
true
;
}
;
.
on
(
'error'
,
)
;
let
=
false
;
const
dataListener
=
(
)
=>
{
=
true
;
}
;
.
on
(
'data'
,
)
;
.
write
(
'Hello'
)
;
.
strictEqual
(
,
true
)
;
=
false
;
.
removeListener
(
'data'
,
)
;
.
write
(
'World'
)
;
.
strictEqual
(
,
false
)
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
true
)
;
=
false
;
.
removeListener
(
'error'
,
)
;
.
on
(
'error'
,
(
)
=>
{
}
)
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
false
)
;
}
)
;
test
(
'WriteableStream - highWaterMark'
,
async
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
,
{
:
3
}
)
;
let
=
.
write
(
'1'
)
;
.
ok
(
!
)
;
=
.
write
(
'2'
)
;
.
ok
(
!
)
;
=
.
write
(
'3'
)
;
.
ok
(
!
)
;
const
=
.
write
(
'4'
)
;
.
ok
(
instanceof
Promise
)
;
const
=
.
write
(
'5'
)
;
.
ok
(
instanceof
Promise
)
;
let
=
false
;
(
async
(
)
=>
{
await
;
=
true
;
}
)
(
)
;
let
=
false
;
(
async
(
)
=>
{
await
;
=
true
;
}
)
(
)
;
let
:
string
|
undefined
=
undefined
;
.
on
(
'data'
,
=>
{
=
;
}
)
;
.
ok
(
)
;
await
timeout
(
0
)
;
.
strictEqual
(
,
true
)
;
.
strictEqual
(
,
true
)
;
}
)
;
test
(
'consumeReadable'
,
(
)
=>
{
const
=
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
;
const
=
consumeReadable
(
,
=>
.
join
(
)
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
}
)
;
test
(
'peekReadable'
,
(
)
=>
{
for
(
let
=
0
;
<
5
;
++
)
{
const
=
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
;
const
=
peekReadable
(
,
=>
.
join
(
)
,
)
;
if
(
typeof
===
'string'
)
{
.
fail
(
'Unexpected result'
)
;
}
else
{
const
=
consumeReadable
(
,
=>
.
join
(
)
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
}
}
let
=
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
;
let
=
peekReadable
(
,
=>
.
join
(
)
,
5
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
=
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
;
=
peekReadable
(
,
=>
.
join
(
)
,
6
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
}
)
;
test
(
'peekReadable - error handling'
,
async
(
)
=>
{
let
=
newWriteableStream
(
=>
)
;
let
:
|
undefined
=
undefined
;
let
=
(
async
(
)
=>
{
try
{
await
peekStream
(
,
1
)
;
}
catch
(
)
{
=
;
}
}
)
(
)
;
.
error
(
new
Error
(
)
)
;
await
;
.
ok
(
)
;
=
newWriteableStream
(
=>
)
;
=
undefined
;
=
(
async
(
)
=>
{
try
{
await
peekStream
(
,
1
)
;
}
catch
(
)
{
=
;
}
}
)
(
)
;
.
write
(
'foo'
)
;
.
error
(
new
Error
(
)
)
;
await
;
.
ok
(
)
;
=
newWriteableStream
(
=>
)
;
=
undefined
;
=
(
async
(
)
=>
{
try
{
await
peekStream
(
,
1
)
;
}
catch
(
)
{
=
;
}
}
)
(
)
;
.
write
(
'foo'
)
;
.
write
(
'bar'
)
;
.
error
(
new
Error
(
)
)
;
await
;
.
ok
(
!
)
;
.
on
(
'error'
,
=>
=
)
;
.
on
(
'data'
,
=>
{
}
)
;
.
ok
(
)
;
}
)
;
function
arrayToReadable < T >
(
:
T
[
]
)
:
<
T
>
{
return
{
read
:
(
)
=>
.
shift
(
)
||
null
}
;
}
function
readableToStream
(
:
<
string
>
)
:
<
string
>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
setTimeout
(
(
)
=>
{
let
:
string
|
null
=
null
;
while
(
(
=
.
read
(
)
)
!==
null
)
{
.
write
(
)
;
}
.
end
(
)
;
}
,
0
)
;
return
;
}
test
(
'consumeStream'
,
async
(
)
=>
{
const
=
readableToStream
(
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
)
;
const
=
await
consumeStream
(
,
=>
.
join
(
)
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
}
)
;
test
(
'consumeStream - without reducer'
,
async
(
)
=>
{
const
=
readableToStream
(
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
)
;
const
=
await
consumeStream
(
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'consumeStream - without reducer and error'
,
async
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
.
error
(
new
Error
(
)
)
;
const
=
await
consumeStream
(
)
;
.
strictEqual
(
,
undefined
)
;
}
)
;
test
(
'listenStream'
,
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
let
=
false
;
let
=
false
;
let
=
''
;
listenStream
(
,
{
onData
:
=>
{
=
;
}
,
onError
:
=>
{
=
true
;
}
,
onEnd
:
(
)
=>
{
=
true
;
}
}
)
;
.
write
(
'Hello'
)
;
.
strictEqual
(
,
'Hello'
)
;
.
write
(
'World'
)
;
.
strictEqual
(
,
'World'
)
;
.
strictEqual
(
,
false
)
;
.
strictEqual
(
,
false
)
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
true
)
;
.
end
(
'Final Bit'
)
;
.
strictEqual
(
,
true
)
;
}
)
;
test
(
'listenStream - cancellation'
,
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
let
=
false
;
let
=
false
;
let
=
''
;
const
=
new
CancellationTokenSource
(
)
;
listenStream
(
,
{
onData
:
=>
{
=
;
}
,
onError
:
=>
{
=
true
;
}
,
onEnd
:
(
)
=>
{
=
true
;
}
}
,
.
)
;
.
cancel
(
)
;
.
write
(
'Hello'
)
;
.
strictEqual
(
,
''
)
;
.
write
(
'World'
)
;
.
strictEqual
(
,
''
)
;
.
error
(
new
Error
(
)
)
;
.
strictEqual
(
,
false
)
;
.
end
(
'Final Bit'
)
;
.
strictEqual
(
,
false
)
;
}
)
;
test
(
'peekStream'
,
async
(
)
=>
{
for
(
let
=
0
;
<
5
;
++
)
{
const
=
readableToStream
(
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
)
;
const
=
await
peekStream
(
,
)
;
.
strictEqual
(
,
.
)
;
if
(
.
)
{
.
fail
(
'Unexpected result, stream should not have ended yet'
)
;
}
else
{
.
strictEqual
(
.
.
,
+
1
,
` maxChunks: ${ i} `
)
;
const
:
string
[
]
=
[
]
;
await
consumeStream
(
,
=>
{
.
push
(
...
)
;
return
.
join
(
)
;
}
)
;
.
strictEqual
(
[
...
.
,
...
]
.
join
(
)
,
'1,2,3,4,5'
)
;
}
}
let
=
readableToStream
(
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
)
;
let
=
await
peekStream
(
,
5
)
;
.
strictEqual
(
,
.
)
;
.
strictEqual
(
.
.
join
(
)
,
'1,2,3,4,5'
)
;
.
strictEqual
(
.
,
true
)
;
=
readableToStream
(
arrayToReadable
(
[
'1'
,
'2'
,
'3'
,
'4'
,
'5'
]
)
)
;
=
await
peekStream
(
,
6
)
;
.
strictEqual
(
,
.
)
;
.
strictEqual
(
.
.
join
(
)
,
'1,2,3,4,5'
)
;
.
strictEqual
(
.
,
true
)
;
}
)
;
test
(
'toStream'
,
async
(
)
=>
{
const
=
toStream
(
'1,2,3,4,5'
,
=>
.
join
(
)
)
;
const
=
await
consumeStream
(
,
=>
.
join
(
)
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
}
)
;
test
(
'toReadable'
,
async
(
)
=>
{
const
=
toReadable
(
'1,2,3,4,5'
)
;
const
=
consumeReadable
(
,
=>
.
join
(
)
)
;
.
strictEqual
(
,
'1,2,3,4,5'
)
;
}
)
;
test
(
'transform'
,
async
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
const
=
transform
(
,
{
data
:
string
=>
string
+
string
}
,
=>
.
join
(
)
)
;
setTimeout
(
(
)
=>
{
.
write
(
'1'
)
;
.
write
(
'2'
)
;
.
write
(
'3'
)
;
.
write
(
'4'
)
;
.
end
(
'5'
)
;
}
,
0
)
;
const
=
await
consumeStream
(
,
=>
.
join
(
)
)
;
.
strictEqual
(
,
'11,22,33,44,55'
)
;
}
)
;
test
(
'events are delivered even if a listener is removed during delivery'
,
(
)
=>
{
const
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
let
=
false
;
let
=
false
;
const
listener1
=
(
)
=>
{
.
removeListener
(
'end'
,
)
;
=
true
;
}
;
const
listener2
=
(
)
=>
{
=
true
;
}
;
.
on
(
'end'
,
)
;
.
on
(
'end'
,
)
;
.
on
(
'data'
,
(
)
=>
{
}
)
;
.
end
(
''
)
;
.
strictEqual
(
,
true
)
;
.
strictEqual
(
,
true
)
;
}
)
;
test
(
'prefixedReadable'
,
(
)
=>
{
let
=
prefixedReadable
(
'1,2'
,
arrayToReadable
(
[
'3'
,
'4'
,
'5'
]
)
,
=>
.
join
(
','
)
)
;
.
strictEqual
(
consumeReadable
(
,
=>
.
join
(
','
)
)
,
'1,2,3,4,5'
)
;
=
prefixedReadable
(
'empty'
,
arrayToReadable < string >
(
[
]
)
,
=>
.
join
(
','
)
)
;
.
strictEqual
(
consumeReadable
(
,
=>
.
join
(
','
)
)
,
'empty'
)
;
}
)
;
test
(
'prefixedStream'
,
async
(
)
=>
{
let
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
.
write
(
'3'
)
;
.
write
(
'4'
)
;
.
write
(
'5'
)
;
.
end
(
)
;
let
=
prefixedStream < string >
(
'1,2'
,
,
=>
.
join
(
','
)
)
;
.
strictEqual
(
await
consumeStream
(
,
=>
.
join
(
','
)
)
,
'1,2,3,4,5'
)
;
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
.
end
(
)
;
=
prefixedStream < string >
(
'1,2'
,
,
=>
.
join
(
','
)
)
;
.
strictEqual
(
await
consumeStream
(
,
=>
.
join
(
','
)
)
,
'1,2'
)
;
=
newWriteableStream < string >
(
=>
.
join
(
)
)
;
.
error
(
new
Error
(
'fail'
)
)
;
=
prefixedStream < string >
(
'error'
,
,
=>
.
join
(
','
)
)
;
let
;
try
{
await
consumeStream
(
,
=>
.
join
(
','
)
)
;
}
catch
(
)
{
=
;
}
.
ok
(
)
;
}
)
;
ensureNoDisposablesAreLeakedInTestSuite
(
)
;
}
)
;