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

util: improve inspects RegExp support #25192

Closed
wants to merge 2 commits into from

Conversation

@BridgeAR
Copy link
Member

commented Dec 23, 2018

Please check the commit messages as description.

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

@BridgeAR BridgeAR requested a review from antsmartian Dec 23, 2018

BridgeAR added 2 commits Dec 23, 2018
util: make inspect aware of RegExp subclasses and null prototype
This adds support for inspect to distinguish regular expression
subclasses and ones with null prototype from "normal" regular
expressions.
test: add more inspect subclassing tests
So far we do not test all data types for subclasses and this extends
the existing tests for WeakSet, WeakMap and BigInt64Array.

@BridgeAR BridgeAR force-pushed the BridgeAR:improve-reg-exp-support branch from 9fd659e to eabee50 Dec 23, 2018

@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 23, 2018

@Trott

This comment has been minimized.

Copy link
Member

commented Dec 23, 2018

AIX failure is a known issue (#24305). I'll open a PR to mark it as flaky.

Pi issue is a new one. It's a crash rather than a simpler test failure and it could be something unrelated to the test itself. Will open an issue for it to track if it recurs.

Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/19769/ ✔️

const expectedWithoutProto = `[${base.name}: null prototype] ${rawExpected}`;
assert.strictEqual(util.inspect(value), expected);
value.foo = 'bar';
assert.notStrictEqual(util.inspect(value), expected);

This comment has been minimized.

Copy link
@antsmartian

antsmartian Dec 24, 2018

Contributor

One small suggestion: may be we want to pull out the test cases for properties in a separate block. Would be happy to see strictEqual rather than notStrictEqual(as it can silently fail on wrong op's).

This comment has been minimized.

Copy link
@BridgeAR

BridgeAR Dec 24, 2018

Author Member

We have lots of tests which verify that the properties are actually displayed correct and they always hit the same code path. Therefore verifying that it's a different result should be sufficient.
Below there's also another test to verify that at least the property is indeed displayed as expected.

The reason for not using the strict comparison here is that each data type has different ways of displaying some parts and it's difficult to generalize that.

This comment has been minimized.

Copy link
@antsmartian

antsmartian Dec 24, 2018

Contributor

Sure, it is sufficient as you said above but thought it could be better using strictEqual. Anyways this is not a blocker to land.

@antsmartian
Copy link
Contributor

left a comment

LGTM

@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 27, 2018

@nodejs/util PTAL.

This needs another review.

BridgeAR added a commit to BridgeAR/node that referenced this pull request Dec 27, 2018
util: make inspect aware of RegExp subclasses and null prototype
This adds support for inspect to distinguish regular expression
subclasses and ones with null prototype from "normal" regular
expressions.

PR-URL: nodejs#25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
BridgeAR added a commit to BridgeAR/node that referenced this pull request Dec 27, 2018
test: add more inspect subclassing tests
So far we do not test all data types for subclasses and this extends
the existing tests for WeakSet, WeakMap and BigInt64Array.

PR-URL: nodejs#25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@BridgeAR

This comment has been minimized.

Copy link
Member Author

commented Dec 27, 2018

Landed in bd13afb and c9d08c7

@BridgeAR BridgeAR closed this Dec 27, 2018

targos added a commit that referenced this pull request Jan 1, 2019
util: make inspect aware of RegExp subclasses and null prototype
This adds support for inspect to distinguish regular expression
subclasses and ones with null prototype from "normal" regular
expressions.

PR-URL: #25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
targos added a commit that referenced this pull request Jan 1, 2019
test: add more inspect subclassing tests
So far we do not test all data types for subclasses and this extends
the existing tests for WeakSet, WeakMap and BigInt64Array.

PR-URL: #25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
refack added a commit to refack/node that referenced this pull request Jan 14, 2019
util: make inspect aware of RegExp subclasses and null prototype
This adds support for inspect to distinguish regular expression
subclasses and ones with null prototype from "normal" regular
expressions.

PR-URL: nodejs#25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
refack added a commit to refack/node that referenced this pull request Jan 14, 2019
test: add more inspect subclassing tests
So far we do not test all data types for subclasses and this extends
the existing tests for WeakSet, WeakMap and BigInt64Array.

PR-URL: nodejs#25192
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
@BridgeAR BridgeAR referenced this pull request Jan 16, 2019
@MylesBorins MylesBorins referenced this pull request Jan 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.