mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
test: add missing newlines to repl .exit writes
some tests write `.exit` into a repl server without including a newline character (`\n`), such commands are therefore simply not executed at all, the changes here add the missing newlines and as a side effect remove no longer necessary `end` calls PR-URL: https://github.com/nodejs/node/pull/58041 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
parent
067a779f17
commit
53abd1a7e2
|
|
@ -1,6 +1,6 @@
|
|||
// Reference: https://github.com/nodejs/node/pull/7624
|
||||
'use strict';
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const repl = require('repl');
|
||||
const stream = require('stream');
|
||||
|
|
@ -9,7 +9,8 @@ const r = initRepl();
|
|||
|
||||
r.input.emit('data', 'function a() { return 42; } (1)\n');
|
||||
r.input.emit('data', 'a\n');
|
||||
r.input.emit('data', '.exit');
|
||||
r.input.emit('data', '.exit\n');
|
||||
r.once('exit', common.mustCall());
|
||||
|
||||
const expected = '1\n[Function: a]\n';
|
||||
const got = r.output.accumulator.join('');
|
||||
|
|
|
|||
|
|
@ -23,5 +23,4 @@ child.on('exit', common.mustCall(() => {
|
|||
}));
|
||||
|
||||
child.stdin.write('await import(\'./message.mjs\');\n');
|
||||
child.stdin.write('.exit');
|
||||
child.stdin.end();
|
||||
child.stdin.write('.exit\n');
|
||||
|
|
|
|||
|
|
@ -136,6 +136,5 @@ r4.close();
|
|||
child.stdin.write(
|
||||
'assert.ok(util.inspect(repl.repl, {depth: -1}).includes("REPLServer"));\n'
|
||||
);
|
||||
child.stdin.write('.exit');
|
||||
child.stdin.end();
|
||||
child.stdin.write('.exit\n');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,4 @@ child.on('exit', common.mustCall(() => {
|
|||
child.stdin.write('const isObject = (obj) => obj.constructor === Object;\n');
|
||||
child.stdin.write('isObject({});\n');
|
||||
child.stdin.write(`require(${JSON.stringify(fixture)}).isObject({});\n`);
|
||||
child.stdin.write('.exit');
|
||||
child.stdin.end();
|
||||
child.stdin.write('.exit\n');
|
||||
|
|
|
|||
|
|
@ -23,5 +23,4 @@ child.on('exit', common.mustCall(() => {
|
|||
}));
|
||||
|
||||
child.stdin.write('require("self_ref");\n');
|
||||
child.stdin.write('.exit');
|
||||
child.stdin.end();
|
||||
child.stdin.write('.exit\n');
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user