11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci// Refs: https://github.com/nodejs/node/issues/7788 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst assert = require('assert'); 51cb0ef41Sopenharmony_ciconst path = require('../common/fixtures').path; 61cb0ef41Sopenharmony_ciconst repl = require('repl'); 71cb0ef41Sopenharmony_ciconst stream = require('stream'); 81cb0ef41Sopenharmony_ciconst inputStream = new stream.PassThrough(); 91cb0ef41Sopenharmony_ciconst outputStream = new stream.PassThrough(); 101cb0ef41Sopenharmony_ciconst fixture = path('is-object.js'); 111cb0ef41Sopenharmony_ciconst r = repl.start({ 121cb0ef41Sopenharmony_ci input: inputStream, 131cb0ef41Sopenharmony_ci output: outputStream, 141cb0ef41Sopenharmony_ci useGlobal: false, 151cb0ef41Sopenharmony_ci}); 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cilet output = ''; 181cb0ef41Sopenharmony_cioutputStream.setEncoding('utf8'); 191cb0ef41Sopenharmony_cioutputStream.on('data', (data) => output += data); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_cir.on('exit', common.mustCall(() => { 221cb0ef41Sopenharmony_ci const results = output.replace(/^> /mg, '').split('\n'); 231cb0ef41Sopenharmony_ci 241cb0ef41Sopenharmony_ci assert.deepStrictEqual(results, ['undefined', 'true', 'true', '']); 251cb0ef41Sopenharmony_ci})); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciinputStream.write('const isObject = (obj) => obj.constructor === Object;\n'); 281cb0ef41Sopenharmony_ciinputStream.write('isObject({});\n'); 291cb0ef41Sopenharmony_ciinputStream.write(`require('${fixture}').isObject({});\n`); 301cb0ef41Sopenharmony_cir.close(); 31