11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst { Readable } = require('stream'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_cilet buf = ''; 71cb0ef41Sopenharmony_ciconst euro = Buffer.from([0xE2, 0x82, 0xAC]); 81cb0ef41Sopenharmony_ciconst cent = Buffer.from([0xC2, 0xA2]); 91cb0ef41Sopenharmony_ciconst source = Buffer.concat([euro, cent]); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst readable = Readable({ encoding: 'utf8' }); 121cb0ef41Sopenharmony_cireadable.push(source.slice(0, 2)); 131cb0ef41Sopenharmony_cireadable.push(source.slice(2, 4)); 141cb0ef41Sopenharmony_cireadable.push(source.slice(4, 6)); 151cb0ef41Sopenharmony_cireadable.push(null); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cireadable.on('data', function(data) { 181cb0ef41Sopenharmony_ci buf += data; 191cb0ef41Sopenharmony_ci}); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ciprocess.on('exit', function() { 221cb0ef41Sopenharmony_ci assert.strictEqual(buf, '€¢'); 231cb0ef41Sopenharmony_ci}); 24