lib: improve the coverage of the validator#42443
Merged
nodejs-github-bot merged 3 commits intonodejs:masterfrom Apr 2, 2022
Merged
lib: improve the coverage of the validator#42443nodejs-github-bot merged 3 commits intonodejs:masterfrom
nodejs-github-bot merged 3 commits intonodejs:masterfrom
Conversation
BridgeAR
requested changes
Mar 23, 2022
Member
BridgeAR
left a comment
There was a problem hiding this comment.
Good catch. Please just move the typeof value !== 'number' check instead of adding additional ones. That would already cover the situation.
In addition, please add a test that verifies that the correct error is thrown.
Contributor
Author
|
@BridgeAR |
lpinca
approved these changes
Mar 23, 2022
aduh95
approved these changes
Mar 24, 2022
test/parallel/test-validators.js
Outdated
|
|
||
| // validateInt32() and validateUint32() | ||
| [ | ||
| Symbol(), 1n, {}, [], false, true, undefined, null, |
Contributor
There was a problem hiding this comment.
Suggested change
| Symbol(), 1n, {}, [], false, true, undefined, null, | |
| Symbol(), 1n, {}, [], false, true, undefined, null, () => {}, '', '1', |
test/parallel/test-validators.js
Outdated
| code: 'ERR_OUT_OF_RANGE' | ||
| })); | ||
| [ | ||
| Symbol(), 1n, {}, [], false, true, undefined, null, |
Contributor
There was a problem hiding this comment.
Suggested change
| Symbol(), 1n, {}, [], false, true, undefined, null, | |
| Symbol(), 1n, {}, [], false, true, undefined, null, () => {}, '', '1', |
| 4294967296, -1, NaN, | ||
| ].forEach((val) => assert.throws(() => validateUint32(val, 'name'), { | ||
| code: 'ERR_OUT_OF_RANGE' | ||
| })); |
Contributor
There was a problem hiding this comment.
Suggested change
| })); | |
| })); | |
| // Ensure it doesn't throw on acceptable values: | |
| validateInt32(0, 'name'); | |
| validateUint32(0, 'name'); | |
| validateInt32(1, 'name'); | |
| validateUint32(1, 'name'); | |
| validateInt32(-1, 'name'); |
BridgeAR
approved these changes
Mar 24, 2022
jasnell
approved these changes
Mar 25, 2022
Collaborator
26 tasks
Contributor
Author
|
It looks like CI is having some problems with centos7-arm64-gcc8,ubuntu1804-arm64,ubuntu2004-arm64. |
Collaborator
This was referenced Mar 28, 2022
Collaborator
|
Landed in 302fd02 |
8 tasks
juanarbol
pushed a commit
to juanarbol/node
that referenced
this pull request
Apr 5, 2022
PR-URL: nodejs#42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol
pushed a commit
that referenced
this pull request
Apr 6, 2022
PR-URL: #42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
xtx1130
pushed a commit
to xtx1130/node
that referenced
this pull request
Apr 25, 2022
PR-URL: nodejs#42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
juanarbol
pushed a commit
that referenced
this pull request
May 31, 2022
PR-URL: #42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
danielleadams
pushed a commit
that referenced
this pull request
Jun 27, 2022
PR-URL: #42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Jul 11, 2022
PR-URL: #42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
targos
pushed a commit
that referenced
this pull request
Jul 31, 2022
PR-URL: #42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
guangwong
pushed a commit
to noslate-project/node
that referenced
this pull request
Oct 10, 2022
PR-URL: nodejs/node#42443 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In current version, if you take
symbolorbigintas arguments to the validator, a native error will be thrown.