mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
789 B
42 lines
789 B
'use strict';
|
|
const common = require('../common');
|
|
|
|
const StreamWrap = require('_stream_wrap');
|
|
const Duplex = require('stream').Duplex;
|
|
|
|
{
|
|
const stream = new Duplex({
|
|
read() {},
|
|
write() {}
|
|
});
|
|
|
|
stream.setEncoding('ascii');
|
|
|
|
const wrap = new StreamWrap(stream);
|
|
|
|
wrap.on('error', common.expectsError({
|
|
type: 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({
|
|
type: Error,
|
|
code: 'ERR_STREAM_WRAP',
|
|
message: 'Stream has StringDecoder set or is in objectMode'
|
|
}));
|
|
|
|
stream.push(new Error('foo'));
|
|
}
|
|
|