test: update repl tests
change var to const or let change assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9991 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
c9945672fc
commit
06306a3944
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable max-len, strict */
|
/* eslint-disable max-len, strict */
|
||||||
var common = require('../common');
|
const common = require('../common');
|
||||||
var assert = require('assert');
|
const assert = require('assert');
|
||||||
|
|
||||||
common.globalCheck = false;
|
common.globalCheck = false;
|
||||||
common.refreshTmpDir();
|
common.refreshTmpDir();
|
||||||
@ -15,11 +15,11 @@ const prompt_npm = 'npm should be run outside of the ' +
|
|||||||
'node repl, in your normal shell.\n' +
|
'node repl, in your normal shell.\n' +
|
||||||
'(Press Control-D to exit.)\n';
|
'(Press Control-D to exit.)\n';
|
||||||
const expect_npm = prompt_npm + prompt_unix;
|
const expect_npm = prompt_npm + prompt_unix;
|
||||||
var server_tcp, server_unix, client_tcp, client_unix, replServer;
|
let server_tcp, server_unix, client_tcp, client_unix, replServer;
|
||||||
|
|
||||||
|
|
||||||
// absolute path to test/fixtures/a.js
|
// absolute path to test/fixtures/a.js
|
||||||
var moduleFilename = require('path').join(common.fixturesDir, 'a');
|
const moduleFilename = require('path').join(common.fixturesDir, 'a');
|
||||||
|
|
||||||
console.error('repl test');
|
console.error('repl test');
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ global.invoke_me = function(arg) {
|
|||||||
|
|
||||||
function send_expect(list) {
|
function send_expect(list) {
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
var cur = list.shift();
|
const cur = list.shift();
|
||||||
|
|
||||||
console.error('sending ' + JSON.stringify(cur.send));
|
console.error('sending ' + JSON.stringify(cur.send));
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ function strict_mode_error_test() {
|
|||||||
|
|
||||||
function error_test() {
|
function error_test() {
|
||||||
// The other stuff is done so reuse unix socket
|
// The other stuff is done so reuse unix socket
|
||||||
var read_buffer = '';
|
let read_buffer = '';
|
||||||
var run_strict_test = true;
|
let run_strict_test = true;
|
||||||
client_unix.removeAllListeners('data');
|
client_unix.removeAllListeners('data');
|
||||||
|
|
||||||
client_unix.on('data', function(data) {
|
client_unix.on('data', function(data) {
|
||||||
@ -70,7 +70,7 @@ function error_test() {
|
|||||||
if (read_buffer.indexOf(prompt_unix) !== -1) {
|
if (read_buffer.indexOf(prompt_unix) !== -1) {
|
||||||
// if it's an exact match, then don't do the regexp
|
// if it's an exact match, then don't do the regexp
|
||||||
if (read_buffer !== client_unix.expect) {
|
if (read_buffer !== client_unix.expect) {
|
||||||
var expect = client_unix.expect;
|
let expect = client_unix.expect;
|
||||||
if (expect === prompt_multiline)
|
if (expect === prompt_multiline)
|
||||||
expect = /[.]{3} /;
|
expect = /[.]{3} /;
|
||||||
assert.ok(read_buffer.match(expect));
|
assert.ok(read_buffer.match(expect));
|
||||||
@ -367,13 +367,13 @@ function tcp_test() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
server_tcp.listen(0, function() {
|
server_tcp.listen(0, function() {
|
||||||
var read_buffer = '';
|
let read_buffer = '';
|
||||||
|
|
||||||
client_tcp = net.createConnection(this.address().port);
|
client_tcp = net.createConnection(this.address().port);
|
||||||
|
|
||||||
client_tcp.on('connect', function() {
|
client_tcp.on('connect', function() {
|
||||||
assert.equal(true, client_tcp.readable);
|
assert.strictEqual(true, client_tcp.readable);
|
||||||
assert.equal(true, client_tcp.writable);
|
assert.strictEqual(true, client_tcp.writable);
|
||||||
|
|
||||||
send_expect([
|
send_expect([
|
||||||
{ client: client_tcp, send: '',
|
{ client: client_tcp, send: '',
|
||||||
@ -436,13 +436,13 @@ function unix_test() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
server_unix.on('listening', function() {
|
server_unix.on('listening', function() {
|
||||||
var read_buffer = '';
|
let read_buffer = '';
|
||||||
|
|
||||||
client_unix = net.createConnection(common.PIPE);
|
client_unix = net.createConnection(common.PIPE);
|
||||||
|
|
||||||
client_unix.on('connect', function() {
|
client_unix.on('connect', function() {
|
||||||
assert.equal(true, client_unix.readable);
|
assert.strictEqual(true, client_unix.readable);
|
||||||
assert.equal(true, client_unix.writable);
|
assert.strictEqual(true, client_unix.writable);
|
||||||
|
|
||||||
send_expect([
|
send_expect([
|
||||||
{ client: client_unix, send: '',
|
{ client: client_unix, send: '',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user