-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
test: remove unneccessary repl magic_mode tests #61053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: remove unneccessary repl magic_mode tests #61053
Conversation
|
|
||
| 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> '); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is effectively a duplicate of
node/test/parallel/test-repl-mode.js
Lines 21 to 30 in 8b14c72
| function testSloppyMode() { | |
| const { input, output } = startNewREPLServer({ replMode: repl.REPL_MODE_SLOPPY, 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> '); | |
| } |
| ]); | ||
| } | ||
|
|
||
| function testMagicMode() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is effectively a duplicate of
node/test/parallel/test-repl-underscore.js
Lines 16 to 50 in 8b14c72
| function testSloppyMode() { | |
| const { replServer, output } = startNewREPLServer({ | |
| prompt: testingReplPrompt, | |
| mode: repl.REPL_MODE_SLOPPY, | |
| }); | |
| // Cannot use `let` in sloppy mode | |
| replServer.write(`_; // initial value undefined | |
| var x = 10; // evaluates to undefined | |
| _; // still undefined | |
| y = 10; // evaluates to 10 | |
| _; // 10 from last eval | |
| _ = 20; // explicitly set to 20 | |
| _; // 20 from user input | |
| _ = 30; // make sure we can set it twice and no prompt | |
| _; // 30 from user input | |
| y = 40; // make sure eval doesn't change _ | |
| _; // remains 30 from user input | |
| `); | |
| assertOutput(output, [ | |
| 'undefined', | |
| 'undefined', | |
| 'undefined', | |
| '10', | |
| '10', | |
| 'Expression assignment to _ now disabled.', | |
| '20', | |
| '20', | |
| '30', | |
| '30', | |
| '40', | |
| '30', | |
| ]); | |
| } |
8b14c72 to
b262504
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #61053 +/- ##
=======================================
Coverage 88.53% 88.53%
=======================================
Files 703 703
Lines 208546 208546
Branches 40217 40222 +5
=======================================
Hits 184634 184634
+ Misses 15926 15913 -13
- Partials 7986 7999 +13 🚀 New features to boost your workflow:
|
|
@dario-piotrowicz please do not repeatedly add the
request-ci
|
|
Landed in e5b6f89 |
PR-URL: nodejs#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>
REPL magic mode has been fully removed in 2018 (#19187) there are however a couple of tests that still test magic_mode. These tests are completely redundant since they are basically simply duplicating equivalent tests of sloppy mode (since that's the mode that REPL will use when it encounters the unrecognized magic mode flag). That's why I'm removing them here.