blob: 6678aeb62671be7b7c771f43ae7bf18724c25d5e (
plain)
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
|
// Flags: --expose-internals
'use strict';
const common = require('../common');
const StreamWrap = require('internal/js_stream_socket');
const Duplex = require('stream').Duplex;
{
const stream = new Duplex({
read() {},
write() {}
});
stream.setEncoding('ascii');
const wrap = new StreamWrap(stream);
wrap.on('error', common.expectsError({
name: 'Error',
code: 'ERR_STREAM_WRAP',
message: 'Stream has StringDecoder set or is in objectMode'
}));
stream.push('ohai');
}
{
const stream = new Duplex({
read() {},
write() {},
objectMode: true
});
const wrap = new StreamWrap(stream);
wrap.on('error', common.expectsError({
name: 'Error',
code: 'ERR_STREAM_WRAP',
message: 'Stream has StringDecoder set or is in objectMode'
}));
stream.push(new Error('foo'));
}
|