-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
assert: replace many if's with if-else statement #14043
Conversation
Won't this conflict with #13973? |
Yes, it will |
Just in one place where |
All in good time... Let's see how thing progress... |
Should I do something with this PR for it to progress? Or it is not depend on me? |
@kuroljov first let me say, welcome, and thank you for your contribution 🥇 For now this PR looks good, if #13973 get's blocked this might land first, if #13973 lands first you'll need to rebase... |
@refack Thank you. Well, let's see then |
I've resolved the conflicts |
@kuroljov It seems like you accidentally pushed a merge commit instead of your rebased changes. This makes it difficult to run CI against your changes and also requires a manual rebase while landing this PR. I assume you added
Please follow these steps to perform a proper rebase:
There will likely be some conflicts at this point. Running
If everything worked, you should have a single commit on top of our upstream master containing your changes. You can push the changes to your repository using
If you need further assistance, please let me know. (Based on #13852 (comment)) |
If assert.fail has less than 3 arguments then some conditions will be applied. However after applying one of them there is no need to check for others.
@tniessen my bad. I pushed rebased assert branch and now it looks like it has no conflicts |
lib/assert.js
Outdated
@@ -62,18 +62,20 @@ function innerFail(actual, expected, message, operator, stackStartFunction) { | |||
} | |||
|
|||
function fail(actual, expected, message, operator, stackStartFunction) { | |||
if (arguments.length === 0) { | |||
const args = arguments.length; |
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.
Nit: Could you name it argsLen
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 knew the argsLen
will be the perfect name. Sure. Just give me a minute
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.
💯
Replace multiple mutually exclusive `if` statements with if-else statements. PR-URL: #14043 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: David Cai <davidcai1993@yahoo.com>
Landed in 6e86a70, thank you for your first contribution! 🎉 Keep up the good work! 🏅 CI on master: https://ci.nodejs.org/job/node-test-commit-linuxone/7086/ |
@tniessen thank you |
This doesn’t seem to apply to v8.x, let me know if I’m mistaken. |
@addaleax not it was not |
@addaleax I misunderstood you. It can be landed on v8. Or if it can't then it definitely might be landed on v9. Sorry |
If assert.fail has less than 3 arguments then some conditions will
be applied. However after applying one of them there is no need to
check for others.
Tests are passing
Checklist
make -j4 test
(UNIX)Affected core subsystem(s)
assert