Skip to content
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

Closed
wants to merge 2 commits into from
Closed

test: minimal repl eval option test #5192

wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Feb 11, 2016

Fixes: #3544

@Trott Trott added repl Issues and PRs related to the REPL subsystem. test Issues and PRs related to the tests. lts-watch-v4.x labels Feb 11, 2016
@Trott
Copy link
Member Author

Trott commented Feb 11, 2016

const assert = require('assert');
const repl = require('repl');

{
Copy link
Contributor

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?

Copy link
Member Author

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).

Copy link
Contributor

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.

@Trott
Copy link
Member Author

Trott commented Feb 11, 2016

@Fishrock123
Copy link
Contributor

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');
Copy link
Contributor

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?

Copy link
Member Author

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.

@jasnell
Copy link
Member

jasnell commented Feb 11, 2016

LGTM

@Trott
Copy link
Member Author

Trott commented Feb 12, 2016

Landed in 90451a6

@Trott Trott closed this Feb 12, 2016
Trott added a commit that referenced this pull request Feb 12, 2016
Fixes: #3544
PR-URL: #5192
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@bnoordhuis
Copy link
Member

Belated LGTM FWIW. Thanks for picking this up. :-)

rvagg pushed a commit that referenced this pull request Feb 15, 2016
Fixes: #3544
PR-URL: #5192
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 18, 2016
Fixes: #3544
PR-URL: #5192
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Feb 18, 2016
Fixes: #3544
PR-URL: #5192
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Feb 18, 2016
stefanmb pushed a commit to stefanmb/node that referenced this pull request Feb 23, 2016
Fixes: nodejs#3544
PR-URL: nodejs#5192
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 2, 2016
Fixes: #3544
PR-URL: #5192
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: James M Snell <[email protected]>
@Trott Trott deleted the repl branch January 13, 2022 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants