-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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: minimal repl eval option test #5192
Conversation
const assert = require('assert'); | ||
const repl = require('repl'); | ||
|
||
{ |
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.
Why this block is necessary?
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.
It's there so that if we write a subsequent test (such as to test that context
is sent on tab completion), we can make sure there are no side effects (because the variables are scoped to the block).
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.
Due to block-scoped vars (i.e. let
and const
) this feature, though existing in es5, is now actually useful.
LGTM |
eval: common.mustCall((cmd, context) => { | ||
// Assertions here will not cause the test to exit with an error code | ||
// so set a boolean that is checked in process.on('exit',...) instead. | ||
evalCalledWithExpectedArgs = (cmd === 'foo\n' && context.foo === 'bar'); |
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.
I think the parens here are unnecessary?
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.
That's right. They're just there for clarity. If they're objectionable, I can remove them.
LGTM |
Landed in 90451a6 |
Fixes: #3544 PR-URL: #5192 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
Belated LGTM FWIW. Thanks for picking this up. :-) |
Fixes: #3544 PR-URL: #5192 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #3544 PR-URL: #5192 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #3544 PR-URL: #5192 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: nodejs#3544 PR-URL: nodejs#5192 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #3544 PR-URL: #5192 Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: James M Snell <[email protected]>
Fixes: #3544