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 buffer transcode test #10043

Closed
wants to merge 1 commit into from
Closed

Conversation

jreading
Copy link

@jreading jreading commented Dec 1, 2016

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

test

Description of change

This test is for argument validation in transcode.

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@imyller imyller added buffer Issues and PRs related to the buffer subsystem. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. labels Dec 1, 2016
@jreading jreading force-pushed the nina-tasks3 branch 7 times, most recently from 618e40a to 5724dd2 Compare December 1, 2016 19:25
@bnoordhuis
Copy link
Member

Just curious, is there a reason you created a new file instead of adding it to test/parallel/test-icu-transcode.js?

@jreading
Copy link
Author

jreading commented Dec 2, 2016

No reason other than I did not see that file. 😄 I'll move this test there.

@@ -39,6 +39,10 @@ for (const test in tests) {
}

assert.throws(
() => buffer.transcode(null, 'utf8', 'ascii'),
/TypeError: "source" argument must be a Buffer/
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're testing the entire error message, you can add ^ and $ to the regular expression.

@@ -39,6 +39,10 @@ for (const test in tests) {
}

assert.throws(
() => buffer.transcode(null, 'utf8', 'ascii'),
/TypeError: "source" argument must be a Buffer/
);
Copy link
Contributor

Choose a reason for hiding this comment

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

tiny nit: new line here.

() => buffer.transcode(null, 'utf8', 'ascii'),
/TypeError: "source" argument must be a Buffer/
);
assert.throws(
() => buffer.transcode(Buffer.from('a'), 'b', 'utf8'),
/Unable to transcode Buffer \[U_ILLEGAL_ARGUMENT_ERROR\]/
Copy link
Member

Choose a reason for hiding this comment

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

Would be better to test the full error message here:

/^Error: Unable to transcode Buffer [U_ILLEGAL_ARGUMENT_ERROR]$/

This test is for argument validation in transcode.

feedback from approvers; full regex error msg & new line
@Trott
Copy link
Member

Trott commented Dec 8, 2016

@italoacasas
Copy link
Contributor

Landed 9f58e02

Thanks for the contribution.

italoacasas pushed a commit that referenced this pull request Dec 12, 2016
This test is for argument validation in transcode.

PR-URL: #10043
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Fishrock123 pushed a commit that referenced this pull request Dec 13, 2016
This test is for argument validation in transcode.

PR-URL: #10043
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
@italoacasas italoacasas mentioned this pull request Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buffer Issues and PRs related to the buffer subsystem. code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants