11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// This is a regression test for https://github.com/joyent/node/issues/8874. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_cirequire('../common'); 61cb0ef41Sopenharmony_ciconst assert = require('assert'); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ciconst spawn = require('child_process').spawn; 91cb0ef41Sopenharmony_ci// Use -i to force node into interactive mode, despite stdout not being a TTY 101cb0ef41Sopenharmony_ciconst args = [ '-i' ]; 111cb0ef41Sopenharmony_ciconst child = spawn(process.execPath, args); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciconst input = 'const foo = "bar\\\nbaz"'; 141cb0ef41Sopenharmony_ci// Match '...' as well since it marks a multi-line statement 151cb0ef41Sopenharmony_ciconst expectOut = /> \.\.\. undefined\n/; 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_cichild.stderr.setEncoding('utf8'); 181cb0ef41Sopenharmony_cichild.stderr.on('data', (d) => { 191cb0ef41Sopenharmony_ci throw new Error('child.stderr be silent'); 201cb0ef41Sopenharmony_ci}); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_cichild.stdout.setEncoding('utf8'); 231cb0ef41Sopenharmony_cilet out = ''; 241cb0ef41Sopenharmony_cichild.stdout.on('data', (d) => { 251cb0ef41Sopenharmony_ci out += d; 261cb0ef41Sopenharmony_ci}); 271cb0ef41Sopenharmony_ci 281cb0ef41Sopenharmony_cichild.stdout.on('end', () => { 291cb0ef41Sopenharmony_ci assert.match(out, expectOut); 301cb0ef41Sopenharmony_ci console.log('ok'); 311cb0ef41Sopenharmony_ci}); 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_cichild.stdin.end(input); 34