xref: /third_party/node/test/parallel/test-zlib-deflate-raw-inherits.js
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/test/parallel/
11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst { DeflateRaw } = require('zlib');
51cb0ef41Sopenharmony_ciconst { Readable } = require('stream');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// Validates that zlib.DeflateRaw can be inherited
81cb0ef41Sopenharmony_ci// with Object.setPrototypeOf
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_cifunction NotInitialized(options) {
111cb0ef41Sopenharmony_ci  DeflateRaw.call(this, options);
121cb0ef41Sopenharmony_ci  this.prop = true;
131cb0ef41Sopenharmony_ci}
141cb0ef41Sopenharmony_ciObject.setPrototypeOf(NotInitialized.prototype, DeflateRaw.prototype);
151cb0ef41Sopenharmony_ciObject.setPrototypeOf(NotInitialized, DeflateRaw);
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciconst dest = new NotInitialized();
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_ciconst read = new Readable({
201cb0ef41Sopenharmony_ci  read() {
211cb0ef41Sopenharmony_ci    this.push(Buffer.from('a test string'));
221cb0ef41Sopenharmony_ci    this.push(null);
231cb0ef41Sopenharmony_ci  }
241cb0ef41Sopenharmony_ci});
251cb0ef41Sopenharmony_ci
261cb0ef41Sopenharmony_ciread.pipe(dest);
271cb0ef41Sopenharmony_cidest.resume();
28

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