-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: add coverage for sparse array maxArrayLength #27901
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really cover the correct part? It seems to be handled in the fast path (formatArray
) since it did not yet detect that it's actually a sparse array.
(Typo in commit message. Can be fixed when landing, though. |
The task was to try to make it for The test is for this line only. The array is already made sparsed on previous test lines. So the detection is on the previous one-liner test there is As for failed build checks, I don't understand how it was able to touch the build itself via test file. Please navigate me to understanding. |
4fec302
to
5ce3d10
Compare
I think after changes coverage is correct. |
/ping @BridgeAR Is this good to land? Or are you still concerned that it doesn't cover the code path intended? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. This will now cover the correct part. It would still be nice though to address the comment to simplify the test case.
test/parallel/test-util-inspect.js
Outdated
delete a[3]; | ||
assert.strictEqual(util.inspect(a, { | ||
maxArrayLength: 2 | ||
}), "[ 'foo', <1 empty item>, ... 3 more items ]"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this could be moved down to be the very last test case. That way there are already enough entries in the array and it would work without pushing / splicing / deleting entries. Calling splice should definitely not be required.
(So below here https://github.com/nodejs/node/blob/5ce3d10434e0d81934f7013a2a13d1502be6aca6/test/parallel/test-util-inspect.js#L520)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I understand.
I will redo.
.splice
is heavy :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code and learn task for additional coverage for situation when maxArrayLength option is passed to util.inspect for sparsed array and is set to number lower than actual number of entries
5ce3d10
to
3eca651
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for following up on it!
Nothing for! |
Passed! Landing this. |
code and learn task for additional coverage for situation when maxArrayLength option is passed to util.inspect for sparse array and is set to number lower than actual number of entries PR-URL: nodejs#27901 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
code and learn task for additional coverage for situation when maxArrayLength option is passed to util.inspect for sparse array and is set to number lower than actual number of entries PR-URL: #27901 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
code and learn task for additional coverage for situation when
maxArrayLength option is passed to util.inspect for sparsed array
and is set to number lower than actual number of entries
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes