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: add fs-assert-encoding's test #10913

Conversation

hiroppy
Copy link
Member

@hiroppy hiroppy commented Jan 20, 2017

Check the error of assertEncoding.
Confirmed in every place being used.(a place where getOptions is used)
assetEncoding:

function assertEncoding(encoding) {

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Jan 20, 2017
@mscdex mscdex added the fs Issues and PRs related to the fs subsystem / file system. label Jan 20, 2017
new RegExp(`^Error: Unknown encoding: ${options}$`);

assert.throws(() => {
fs.readFile('path', options, () => {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a noop variable, give it the value of () => {}, then just reuse that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated:)

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more small nit, but LGTM

const options = 'test';
const noop = () => {};
const unknownEncodingMessage =
new RegExp(`^Error: Unknown encoding: ${options}$`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since options never changes, you can just use test in the regex, and use a literal instead of the RegExp() constructor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Check the error of `assertEncoding`.
Confirmed in every place being used.(a place where `getoptions` is used)
assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18
@cjihrig
Copy link
Contributor

cjihrig commented Jan 21, 2017

@lpinca
Copy link
Member

lpinca commented Jan 25, 2017

Landed in aa4fe92.

@lpinca lpinca closed this Jan 25, 2017
@lpinca
Copy link
Member

lpinca commented Jan 25, 2017

Ops I messed up.

@lpinca lpinca reopened this Jan 25, 2017
@gibfahn
Copy link
Member

gibfahn commented Jan 25, 2017

@lpinca you can still git push --force-with-lease to remove that commit again.

@lpinca
Copy link
Member

lpinca commented Jan 25, 2017

@gibfahn yes thanks, but I only closed the wrong PR by mistake :)

@hiroppy
Copy link
Member Author

hiroppy commented Feb 1, 2017

@lpinca Can I merge to master?

@lpinca
Copy link
Member

lpinca commented Feb 1, 2017

@abouthiroppy sure.

@hiroppy
Copy link
Member Author

hiroppy commented Feb 1, 2017

@hiroppy
Copy link
Member Author

hiroppy commented Feb 1, 2017

test/freebsd's test failed... I think code is unrelated.

@lpinca
Copy link
Member

lpinca commented Feb 1, 2017

Yes, there are some failures on freebsd10-64 but nothing seems to point to these changes. Go ahead.

hiroppy added a commit that referenced this pull request Feb 1, 2017
Check the error of `assertEncoding`.
Confirmed in every place being used.(a place where `getoptions` is used)
assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18

PR-URL: #10913
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@hiroppy
Copy link
Member Author

hiroppy commented Feb 1, 2017

Landed in 9db8973.

@hiroppy hiroppy closed this Feb 1, 2017
@hiroppy hiroppy deleted the feature/add-test-fs-assert-encoding-error branch February 1, 2017 08:56
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 2, 2017
Check the error of `assertEncoding`.
Confirmed in every place being used.(a place where `getoptions` is used)
assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18

PR-URL: nodejs#10913
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Feb 14, 2017
Check the error of `assertEncoding`.
Confirmed in every place being used.(a place where `getoptions` is used)
assetEncoding: https://github.com/nodejs/node/blob/521767c88605cb6481ea98f396924e55f9dd22f4/lib/internal/fs.js#L18

PR-URL: nodejs#10913
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@jasnell
Copy link
Member

jasnell commented Mar 7, 2017

This is not landing cleanly on v6 or v4. Backport?

@jasnell
Copy link
Member

jasnell commented Mar 8, 2017

Test fails on both v4 and v6 btw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants