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

assert: allow circular references #6432

Closed
wants to merge 2 commits into from
Closed

assert: allow circular references #6432

wants to merge 2 commits into from

Conversation

Trott
Copy link
Member

@Trott Trott commented Apr 27, 2016

Checklist
  • tests and code linting passes
  • a test and/or benchmark is included
  • the commit message follows commit guidelines
Affected core subsystem(s)

assert test

Description of change

assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

Fixes: #6416

@Trott Trott added the assert Issues and PRs related to the assert subsystem. label Apr 27, 2016
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Apr 27, 2016
return objEquiv(actual, expected, strict);
memos = memos || {actual: [], expected: []};

if (memos.actual.includes(actual)) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use memos.actual.indexOf here and cache it for the next call?

@Fishrock123 Fishrock123 removed the test Issues and PRs related to the tests. label Apr 27, 2016
@Fishrock123
Copy link
Contributor

Looks like @nodejs-github-bot wrongly labeled this, investigating at #6432

assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

Fixes: nodejs#6416
phillipj added a commit to nodejs/github-bot that referenced this pull request Apr 28, 2016
This fixes some bad labelling by ensuring that *every* file affected in
the PR actually matches an exclusive label when we're checking for exclusive labels.

Refs nodejs/node#6448 nodejs/node#6432
Closes #33
@Trott
Copy link
Member Author

Trott commented Apr 28, 2016

Took @addaleax's suggestions, rebased, force-pushed. Hoping to hold off on CI until the pesky issues with tick processor vs. OS X are resolved.

phillipj added a commit to nodejs/github-bot that referenced this pull request Apr 28, 2016
This fixes some bad labelling by ensuring that *every* file affected in
the PR actually matches an exclusive label when we're checking for exclusive labels.

Refs nodejs/node#6448 nodejs/node#6432
Closes #33
@addaleax
Copy link
Member

LGTM

1 similar comment
@jasnell
Copy link
Member

jasnell commented Apr 29, 2016

LGTM

@thefourtheye
Copy link
Contributor

Isn't assert just for the core? Does the core need this change?

@Trott
Copy link
Member Author

Trott commented Apr 29, 2016

@thefourtheye asked:

Isn't assert just for the core? Does the core need this change?

It's not difficult to imagine that a test we write might want to compare two objects that contain circular references.

I think it makes sense to fix this bug before we come across that need rather than waiting for it to come up and create problems for the person who is writing that test.

This is a bug fix. If it were a new feature or an API change, the bar would be considerably higher (in my opinion, at least).

@jasnell
Copy link
Member

jasnell commented Apr 29, 2016

+1 to what @Trott said.

@thefourtheye
Copy link
Contributor

Well, most of the times we would be able to argue that features are bug fixes and vice versa.

For example, this patch could also be interpreted as, asserting circular references feature. At the same time, #2315 can be argued as, bug while asserting Maps and Sets.

@jasnell
Copy link
Member

jasnell commented Apr 29, 2016

@Trott
Copy link
Member Author

Trott commented Apr 29, 2016

@thefourtheye I'm taking your comments to mean that you might be skeptical of the need for this, but you aren't opposed to doing this. So I'm going to land this now. (But if I'm wrong, we can revert.)

Trott added a commit to Trott/io.js that referenced this pull request Apr 29, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: nodejs#6432
Fixes: nodejs#6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@Trott
Copy link
Member Author

Trott commented Apr 29, 2016

Landed in d3aafd0.

@Trott Trott closed this Apr 29, 2016
Fishrock123 pushed a commit that referenced this pull request May 4, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
joelostrowski pushed a commit to joelostrowski/node that referenced this pull request May 4, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: nodejs#6432
Fixes: nodejs#6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Fishrock123 added a commit that referenced this pull request May 5, 2016
* assert: `deep{Strict}Equal()` now works correctly with circular
references. (Rich Trott) #6432
* debugger: Arrays are now formatted correctly in the debugger repl.
(cjihrig) #6448
* deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu)
#6550
* net: Introduced a `Socket#connecting` property. (Fedor Indutny)
#6404
  - Previously this information was only available as the undocumented,
internal `_connecting` property.
* process: Introduced `process.cpuUsage()`. (Patrick Mueller)
#6157
* stream: `Writable#setDefaultEncoding()` now returns `this`.
(Alexander Makarenko) #5040
* util: Two new additions to `util.inspect()`:
  - Added a `maxArrayLength` option to truncate the formatting of
Arrays. (James M Snell) #6334
    - This is set to `100` by default.
  - Added a `showProxy` option for formatting proxy intercepting
handlers. (James M Snell) #6465
    - Inspecting proxies is non-trivial and as such this is off by
default.

PR-URL: #6557
Fishrock123 added a commit that referenced this pull request May 5, 2016
* assert: `deep{Strict}Equal()` now works correctly with circular
references. (Rich Trott) #6432
* debugger: Arrays are now formatted correctly in the debugger repl.
(cjihrig) #6448
* deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu)
#6550
  - Please see our blog post for more info on the security contents of this release:
  - https://nodejs.org/en/blog/vulnerability/openssl-may-2016/
* net: Introduced a `Socket#connecting` property. (Fedor Indutny)
#6404
  - Previously this information was only available as the undocumented,
internal `_connecting` property.
* process: Introduced `process.cpuUsage()`. (Patrick Mueller)
#6157
* stream: `Writable#setDefaultEncoding()` now returns `this`.
(Alexander Makarenko) #5040
* util: Two new additions to `util.inspect()`:
  - Added a `maxArrayLength` option to truncate the formatting of
Arrays. (James M Snell) #6334
    - This is set to `100` by default.
  - Added a `showProxy` option for formatting proxy intercepting
handlers. (James M Snell) #6465
    - Inspecting proxies is non-trivial and as such this is off by
default.

PR-URL: #6557
Fishrock123 added a commit that referenced this pull request May 5, 2016
* assert: `deep{Strict}Equal()` now works correctly with circular
references. (Rich Trott) #6432
* debugger: Arrays are now formatted correctly in the debugger repl.
(cjihrig) #6448
* deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu)
#6550
- Please see our blog post for more info on the security contents of
this release:
- https://nodejs.org/en/blog/vulnerability/openssl-may-2016/
* net: Introduced a `Socket#connecting` property. (Fedor Indutny)
#6404
- Previously this information was only available as the undocumented,
internal `_connecting` property.
* process: Introduced `process.cpuUsage()`. (Patrick Mueller)
#6157
* stream: `Writable#setDefaultEncoding()` now returns `this`.
(Alexander Makarenko) #5040
* util: Two new additions to `util.inspect()`:
- Added a `maxArrayLength` option to truncate the formatting of
Arrays. (James M Snell) #6334
- This is set to `100` by default.
- Added a `showProxy` option for formatting proxy intercepting
handlers. (James M Snell) #6465
- Inspecting proxies is non-trivial and as such this is off by
default.

PR-URL: #6557
azu added a commit to azu/universal-deep-strict-equal that referenced this pull request May 6, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

fix: twada#3
refs:nodejs/node#6416
       nodejs/node#6432
azu added a commit to azu/universal-deep-strict-equal that referenced this pull request May 6, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

fix: twada#3
refs:nodejs/node#6416
       nodejs/node#6432
@MylesBorins
Copy link
Contributor

@Trott lts?

@Trott
Copy link
Member Author

Trott commented Jun 2, 2016

@thealphanerd Yes, if it lands cleanly.

MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 12, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jul 12, 2016
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jul 14, 2016
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.

PR-URL: #6432
Fixes: #6416
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
@Trott Trott deleted the ada branch January 13, 2022 22:43
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.

assert.deepEqual loops forever with circular refs
7 participants