0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-repl-setprompt.js
Myles Borins 6c032a8333 test: replace util with backtick strings
Now that we have backticks we no longer need to use util.format
to template strings!

This commit was inspired by #3324, and it replaces instances of
util.format with backtick strings in a number of tests

Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/3359
2015-10-14 10:02:47 -07:00

29 lines
645 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
const os = require('os');
var args = [
'-e',
'var e = new (require("repl")).REPLServer("foo.. "); e.context.e = e;',
];
var p = 'bar.. ';
var child = spawn(process.execPath, args);
child.stdout.setEncoding('utf8');
var data = '';
child.stdout.on('data', function(d) { data += d; });
child.stdin.end(`e.setPrompt("${p}");${os.EOL}`);
child.on('close', function(code, signal) {
assert.strictEqual(code, 0);
assert.ok(!signal);
var lines = data.split(/\n/);
assert.strictEqual(lines.pop(), p);
});