mirror of
https://github.com/nodejs/node.git
synced 2025-12-28 07:50:41 +00:00
test: remove unneccessary repl magic_mode tests
PR-URL: https://github.com/nodejs/node/pull/61053 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
6338e643a8
commit
e5b6f89328
@ -11,7 +11,6 @@ if (process.env.TERM === 'dumb') {
|
||||
const tests = [
|
||||
testSloppyMode,
|
||||
testStrictMode,
|
||||
testAutoMode,
|
||||
testStrictModeTerminal,
|
||||
];
|
||||
|
||||
@ -56,14 +55,3 @@ function testStrictModeTerminal() {
|
||||
output.accumulator.includes('\n// ReferenceError: xyz is not defined')
|
||||
);
|
||||
}
|
||||
|
||||
function testAutoMode() {
|
||||
const { input, output } = startNewREPLServer({ replMode: repl.REPL_MODE_MAGIC, terminal: false, prompt: '> ' });
|
||||
|
||||
input.emit('data', 'x = 3\n');
|
||||
assert.strictEqual(output.accumulator, '> 3\n> ');
|
||||
output.accumulator = '';
|
||||
|
||||
input.emit('data', 'let y = 3\n');
|
||||
assert.strictEqual(output.accumulator, 'undefined\n> ');
|
||||
}
|
||||
|
||||
@ -9,7 +9,6 @@ const testingReplPrompt = '_REPL_TESTING_PROMPT_>';
|
||||
|
||||
testSloppyMode();
|
||||
testStrictMode();
|
||||
testMagicMode();
|
||||
testResetContext();
|
||||
testResetContextGlobal();
|
||||
testError();
|
||||
@ -86,46 +85,9 @@ function testStrictMode() {
|
||||
]);
|
||||
}
|
||||
|
||||
function testMagicMode() {
|
||||
const { replServer, output } = startNewREPLServer({
|
||||
prompt: testingReplPrompt,
|
||||
mode: repl.REPL_MODE_MAGIC,
|
||||
});
|
||||
|
||||
replServer.write(`_; // initial value undefined
|
||||
x = 10; //
|
||||
_; // last eval - 10
|
||||
let _ = 20; // undefined
|
||||
_; // 20 from user input
|
||||
_ = 30; // make sure we can set it twice and no prompt
|
||||
_; // 30 from user input
|
||||
var y = 40; // make sure eval doesn't change _
|
||||
_; // remains 30 from user input
|
||||
function f() { let _ = 50; return _; } // undefined
|
||||
f(); // 50
|
||||
_; // remains 30 from user input
|
||||
`);
|
||||
|
||||
assertOutput(output, [
|
||||
'undefined',
|
||||
'10',
|
||||
'10',
|
||||
'undefined',
|
||||
'20',
|
||||
'30',
|
||||
'30',
|
||||
'undefined',
|
||||
'30',
|
||||
'undefined',
|
||||
'50',
|
||||
'30',
|
||||
]);
|
||||
}
|
||||
|
||||
function testResetContext() {
|
||||
const { replServer, output } = startNewREPLServer({
|
||||
prompt: testingReplPrompt,
|
||||
mode: repl.REPL_MODE_MAGIC,
|
||||
});
|
||||
|
||||
replServer.write(`_ = 10; // explicitly set to 10
|
||||
|
||||
Loading…
Reference in New Issue
Block a user