Skip to content

Conversation

@eudaimos
Copy link
Contributor

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

Tests for crypto.createHmac(..) affected

Description of change

For better equals assertions within the test/parallel/test-crypto-hmac.js switching from assert.equals(..) to assert.strictEquals(..)

Question for @maintainers

I had to make a 2nd commit to fix the linting errors.
Should I squash them for the PR?
(the guidelines don't mention this either way)

because in 2 cases the assert.equals for several assertions had long arguments, those arguments were misaligned when changing to assert.strictEquals so this commit adds the extra space for alignment. in both cases, the final argument with prepended whitespace extends past the 80 char limit, so these args end up being split onto 2 lines
@nodejs-github-botnodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@imyllerimyller added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Dec 1, 2016
@mscdexmscdex added the crypto Issues and PRs related to the crypto subsystem. label Dec 1, 2016
@imyller
Copy link
Member

Should I squash them for the PR?

For me personally, it is ok to have multiple commits. Collaborator responsible for landing can squash if required. 👍

assert.strictEqual(wikipedia[i]['hmac'][hash],
result,
'Test HMAC-'+hash+': Test case '+(i+1)
+' wikipedia');
Copy link
Member

@jasnelljasnellDec 5, 2016

Choose a reason for hiding this comment

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

We may be able to avoid wrapping here by using a template literal:

`Test HMAC-${hash}: Test case ${i + 1} wikipedia` 

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@jasnell I updated this using template string

assert.strictEqual(rfc4231[i]['hmac'][hash],
result,
'Test HMAC-'+hash+': Test case '+(i+1)
+' rfc 4231');
Copy link
Member

Choose a reason for hiding this comment

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

ditto here...

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@jasnell and this one too

Copy link
Member

@jasnelljasnell left a comment

Choose a reason for hiding this comment

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

LGTM with a couple of nits

in 2 cases the change to strictEquals caused extra indentation which made the concatenated assertion failure messages span 2 lines - these were switched to use template strings instead where they now fit onto a single line within the 80 char limit additionally updated the last 2 assertion messages using template strings in order to remain consistent.
@Trott
Copy link
Member

Trott commented Dec 7, 2016

@eudaimos
Copy link
ContributorAuthor

@jasnell I also updated the other dynamic assertion messages (2 of them at the bottom) to use template strings for consistency

Trott pushed a commit to Trott/io.js that referenced this pull request Dec 8, 2016
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: nodejs#9958 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
@Trott
Copy link
Member

Trott commented Dec 8, 2016

Landed in 1e4b9a1.
Thanks for the contribution! 🎉

@TrottTrott closed this Dec 8, 2016
@eudaimos
Copy link
ContributorAuthor

Awesome! My first one - thanks @Trott and @jasnell

Fishrock123 pushed a commit that referenced this pull request Dec 13, 2016
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: #9958 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
@italoacasasitaloacasas mentioned this pull request Dec 15, 2016
MylesBorins pushed a commit that referenced this pull request Dec 20, 2016
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: #9958 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit that referenced this pull request Dec 21, 2016
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: #9958 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Dec 21, 2016
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-and-learnIssues related to the Code-and-Learn events and PRs submitted during the events.cryptoIssues and PRs related to the crypto subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@eudaimos@imyller@Trott@jasnell@cjihrig@mscdex@MylesBorins@nodejs-github-bot