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: refactor test-http-write-empty-string to use arrow functions #24483

Closed

Conversation

sagirk
Copy link
Contributor

@sagirk sagirk commented Nov 19, 2018

In test/parallel/test-http-write-empty-string.js, callbacks use
anonymous closure functions. It is safe to replace them with arrow
functions since these callbacks don't contain references to this,
super or arguments. This results in shorter functions.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. It is safe to replace them with arrow
functions since these callbacks don't contain references to `this`,
`super` or `arguments`. This results in shorter functions.
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Nov 19, 2018
@gireeshpunathil gireeshpunathil added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Nov 19, 2018
In `test/parallel/test-http-write-empty-string.js`, the callback passed
to `http.createServer` contains a reference to `this`. Since the object
referenced by `this` doesn't pre-exist, revert the arrow function to an
anonymous closure function as a callback.

Similarly, the callback passed to `server.listen` too contains a
reference to `this`. However, in this case, `this` resolves to a
pre-existing object `server`. Therefore, it is safe to use an arrow
function as a callback as long as `this` is replaced with `server`.
Fix ESLint complaint: "28:42 Unexpected space before function
parentheses space-before-function-paren".
@gireeshpunathil
Copy link
Member

@Trott Trott added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 20, 2018
@Trott
Copy link
Member

Trott commented Nov 21, 2018

👍 here to fast-track.

@Trott Trott added the fast-track PRs that do not need to wait for 48 hours to land. label Nov 21, 2018
Trott pushed a commit to Trott/io.js that referenced this pull request Nov 21, 2018
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: nodejs#24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@Trott
Copy link
Member

Trott commented Nov 21, 2018

Landed in e610685

@Trott Trott closed this Nov 21, 2018
targos pushed a commit that referenced this pull request Nov 21, 2018
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
rvagg pushed a commit that referenced this pull request Nov 28, 2018
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@BridgeAR BridgeAR mentioned this pull request Dec 5, 2018
4 tasks
codebytere pushed a commit that referenced this pull request Jan 13, 2019
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
refack pushed a commit to refack/node that referenced this pull request Jan 14, 2019
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: nodejs#24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
@codebytere codebytere mentioned this pull request Jan 15, 2019
codebytere pushed a commit that referenced this pull request Jan 29, 2019
In `test/parallel/test-http-write-empty-string.js`, callbacks use
anonymous closure functions. Replace them with arrow functions.

PR-URL: #24483
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. fast-track PRs that do not need to wait for 48 hours to land. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants