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 #6430

Closed
wants to merge 1 commit into from
Closed

assert: allow circular references #6430

wants to merge 1 commit 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)

test assert

Description of change

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

Refs: strager/node@56dbd80
Fixes: #6416

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

Refs: strager/node@56dbd80
Fixes: nodejs#6416
@Trott Trott added assert Issues and PRs related to the assert subsystem. test Issues and PRs related to the tests. labels Apr 27, 2016
@Trott
Copy link
Member Author

Trott commented Apr 27, 2016

Er, nope, this won't work...all circular references are treated as identical, so this won't fire an AssertionError because c.b and b.b are both circular references, even though they are circular references to totally different things:

b = {};
b.a = 1;
b.b = b;

c = {};
c.a = 1;
c.b = c.a;

assert.deepStrictEqual(b, c);

@Trott Trott closed this Apr 27, 2016
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. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assert.deepEqual loops forever with circular refs
1 participant