2016-06-10 09:27:15 +02:00
|
|
|
'use strict';
|
2017-03-24 09:46:44 -07:00
|
|
|
|
2017-10-29 16:36:32 +01:00
|
|
|
const common = require('../common');
|
2016-06-10 09:27:15 +02:00
|
|
|
const stream = require('stream');
|
|
|
|
|
2019-07-16 00:03:23 +02:00
|
|
|
function testPushArg(val) {
|
|
|
|
const readable = new stream.Readable({
|
|
|
|
read: () => {}
|
|
|
|
});
|
|
|
|
readable.on('error', common.expectsError({
|
2017-10-29 16:36:32 +01:00
|
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
2019-12-25 18:02:16 +01:00
|
|
|
name: 'TypeError'
|
2019-07-16 00:03:23 +02:00
|
|
|
}));
|
|
|
|
readable.push(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
testPushArg([]);
|
|
|
|
testPushArg({});
|
|
|
|
testPushArg(0);
|
|
|
|
|
|
|
|
function testUnshiftArg(val) {
|
|
|
|
const readable = new stream.Readable({
|
|
|
|
read: () => {}
|
2017-10-29 16:36:32 +01:00
|
|
|
});
|
2019-07-16 00:03:23 +02:00
|
|
|
readable.on('error', common.expectsError({
|
|
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
2019-12-25 18:02:16 +01:00
|
|
|
name: 'TypeError'
|
2019-07-16 00:03:23 +02:00
|
|
|
}));
|
|
|
|
readable.unshift(val);
|
2017-10-29 16:36:32 +01:00
|
|
|
}
|
|
|
|
|
2019-07-16 00:03:23 +02:00
|
|
|
testUnshiftArg([]);
|
|
|
|
testUnshiftArg({});
|
|
|
|
testUnshiftArg(0);
|