xref: /third_party/node/test/parallel/test-stream-readable-invalid-chunk.js (revision 1cb0ef41)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciconst stream = require('stream');
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_cifunction testPushArg(val) {
71cb0ef41Sopenharmony_ci  const readable = new stream.Readable({
81cb0ef41Sopenharmony_ci    read: () => {}
91cb0ef41Sopenharmony_ci  });
101cb0ef41Sopenharmony_ci  readable.on('error', common.expectsError({
111cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_TYPE',
121cb0ef41Sopenharmony_ci    name: 'TypeError'
131cb0ef41Sopenharmony_ci  }));
141cb0ef41Sopenharmony_ci  readable.push(val);
151cb0ef41Sopenharmony_ci}
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_citestPushArg([]);
181cb0ef41Sopenharmony_citestPushArg({});
191cb0ef41Sopenharmony_citestPushArg(0);
201cb0ef41Sopenharmony_ci
211cb0ef41Sopenharmony_cifunction testUnshiftArg(val) {
221cb0ef41Sopenharmony_ci  const readable = new stream.Readable({
231cb0ef41Sopenharmony_ci    read: () => {}
241cb0ef41Sopenharmony_ci  });
251cb0ef41Sopenharmony_ci  readable.on('error', common.expectsError({
261cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_ARG_TYPE',
271cb0ef41Sopenharmony_ci    name: 'TypeError'
281cb0ef41Sopenharmony_ci  }));
291cb0ef41Sopenharmony_ci  readable.unshift(val);
301cb0ef41Sopenharmony_ci}
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_citestUnshiftArg([]);
331cb0ef41Sopenharmony_citestUnshiftArg({});
341cb0ef41Sopenharmony_citestUnshiftArg(0);
35

Indexes created Thu Nov 07 10:32:03 CST 2024