FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

assert: fix boxed primitives in deep*Equal by BridgeAR · Pull Request #15050 · nodejs/node · GitHub

/ node Public

assert: fix boxed primitives in deep*Equal - #15050

Closed
BridgeAR wants to merge 2 commits into
nodejs:masterfrom
BridgeAR:assert-boxed
Closed

assert: fix boxed primitives in deep*Equal#15050
BridgeAR wants to merge 2 commits into
nodejs:masterfrom
BridgeAR:assert-boxed

Conversation

BridgeAR commented Aug 27, 2017
edited
Loading

Copy link
Copy Markdown
Member

Unbox all primitives and compare them as well instead of
only comparing boxed strings.

This is blocked by #15036 because there is a test case from N-API that currently only passes because deepStrictEqual is not testing them properly and this hides the underlying NaN issue.

AssertionError [ERR_ASSERTION]: [Number: NaN] deepStrictEqual [Number: NaN]
    at Object.<anonymous> (/node/test/addons-napi/test_conversions/test.js:119:8)

Update: I commented out the failing test for now.

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
Affected core subsystem(s)

assert

BridgeAR added the blocked PRs that are blocked by other issues or PRs. label Aug 27, 2017
nodejs-github-bot added the assert Issues and PRs related to the assert subsystem. label Aug 27, 2017
Comment thread lib/assert.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

rawA [](start = 10, length = 4)

nit: can you have better name like rawAcual ?

Copy link
Copy Markdown
Member Author

I rebased due to conflicts, addressed the nit and added a fast path for boxed primitives. I also commented out the failing test, so now it is not blocked anymore.

BridgeAR removed the blocked PRs that are blocked by other issues or PRs. label Aug 29, 2017

jasnell commented Aug 29, 2017

Copy link
Copy Markdown
Member

Curious about the semver-iness of this change. Thoughts @nodejs/tsc?

jasnell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The code change LGTM but I'd like a CITGM run and others from @nodejs/tsc to sign off

Copy link
Copy Markdown
Member Author

BridgeAR commented Sep 1, 2017

Copy link
Copy Markdown
Member Author

Rebased due to conflicts.

BridgeAR commented Sep 2, 2017

Copy link
Copy Markdown
Member Author

Ping @nodejs/ctc @nodejs/tsc PTAL

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can we remove the todo and add the test back?

BridgeAR Sep 2, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Not before #15036 landed (still trying to figure out if that one should be semver-major or a patch though). Otherwise the test would fail.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

what's the depedency of this change to #15036?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Currently assert.deepStrictEqual(NaN, NaN) will fail. This test only worked because NaN was never compared as it was not unboxed before. #15036 will change that to not fail anymore in case NaN is compared to itself.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Have you pushed you changes to this PR? Looks like these lines are still commented?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks a lot for reminding me! It is now back in place.

nodejs deleted a comment Sep 2, 2017
nodejs deleted a comment Sep 2, 2017
nodejs deleted a comment Sep 2, 2017
Comment thread lib/assert.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

IIUC this also affects objects with custom valueOf, so the documentation needs to be updated as well..

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You are right! I am going to add that to the documentation.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Addressed

BridgeAR requested a review from Trott September 4, 2017 12:41
Comment thread doc/api/assert.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nit: Perhaps change the comment to something like:

OK because the object and the string are identical when unwrapped.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'm confused by this documentation. It's supposed to document new behavior you're adding, right? But the assertions here are already fail/succeed as described in Node.js 8.4.0 so the behavior isn't because of any changes added here. Am I misunderstanding?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Changed. I indeed chose a bad example for the number and updated that. Currently only wrapped strings are compared but in my former example with the wrapped number, the toString() was not identical and it failed early.

Comment thread doc/api/assert.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Micro-nit: Fails as the wrapped number is... -> Fails because the wrapped number is...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the suggestion!

Unbox all primitives and compare them as well instead of
only comparing boxed strings.

BridgeAR commented Sep 5, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

Rebased due to conflicts

Trott left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems good to me. I've refrained from giving at a green check because I worry I may not be grasping all the ramifications.

Copy link
Copy Markdown
Member

LGTM with the commented test uncommented

BridgeAR commented Sep 12, 2017
edited
Loading

Copy link
Copy Markdown
Member Author

Landed in 22ae8c0

BridgeAR closed this Sep 12, 2017
BridgeAR added a commit that referenced this pull request Sep 12, 2017
Unbox all primitives and compare them as well instead of
only comparing boxed strings.

PR-URL: #15050
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
addaleax pushed a commit to addaleax/node that referenced this pull request Sep 13, 2017
Unbox all primitives and compare them as well instead of
only comparing boxed strings.

PR-URL: nodejs#15050
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>

jasnell commented Sep 20, 2017

Copy link
Copy Markdown
Member

this would need to be backported for v8.x

BridgeAR added a commit to BridgeAR/node that referenced this pull request Sep 21, 2017
Unbox all primitives and compare them as well instead of
only comparing boxed strings.

PR-URL: nodejs#15050
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
jasnell pushed a commit that referenced this pull request Sep 21, 2017
Unbox all primitives and compare them as well instead of
only comparing boxed strings.

PR-URL: #15050
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
BridgeAR deleted the assert-boxed branch April 1, 2019 23:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

assert Issues and PRs related to the assert subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL