test: validate arguments to mustCall(), fix incorrect tests#10692
test: validate arguments to mustCall(), fix incorrect tests#10692nfriedly wants to merge 2 commits intonodejs:masterfrom
Conversation
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message.
test/common.js
Outdated
There was a problem hiding this comment.
I don't think this syntax is supported on v4. This will need to be changed now or during backport.
There was a problem hiding this comment.
Oh, I didn't realize this would be backported. Which is the preferred method - older syntax everywhere, or change during the backport?
There was a problem hiding this comment.
I think the simplest thing to do would be to update this PR. If expected === undefined, set it to 1. Otherwise, throw a TypeError if typeof expected !== 'number'. I don't think we need to worry about negative numbers slipping through, because they should blow up during development.
There was a problem hiding this comment.
Done. I tried running the test under v4 just to see it, but there are other bits of modern elsewhere in common.js :/
test/common.js
Outdated
There was a problem hiding this comment.
Can you drop the curly braces on both if statements.
test/common.js
Outdated
There was a problem hiding this comment.
Make this an else if, and drop the expected < 0 check.
test/common.js
Outdated
There was a problem hiding this comment.
Change this to a TypeError.
test/parallel/test-common.js
Outdated
There was a problem hiding this comment.
The trailing () shouldn't be necessary here.
test/parallel/test-common.js
Outdated
test/parallel/test-common.js
Outdated
There was a problem hiding this comment.
Can you do /^TypeError: Invalid expected value: foo$/. Also, drop the insensitive check.
test/parallel/test-common.js
Outdated
3dac8a1 to
c5ba0c3
Compare
|
@cjihrig I made several improvements that I believe address everything you pointed out, and then rebased it back to two commits because the log was getting a bit hairy. |
test/common.js
Outdated
There was a problem hiding this comment.
Move expected = 1; to its own line please.
c5ba0c3 to
f3c1855
Compare
test/parallel/test-common.js
Outdated
There was a problem hiding this comment.
Nit: can you please remove one of these 2 blank lines?
instead of silently overwriting invalid values with the default
f3c1855 to
cd7ce11
Compare
|
LGTM and thanks! 🎉 |
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: #10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: #10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
|
Landed in 762a303 |
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: nodejs#10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
|
Missed a commit in the backport... nvm |
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: #10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: #10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
This fixes a misplaced parenthesis in each of the tests in test/parallel/test-http-response-statuscodes.js, causing the tests to pass as long as any error was thrown, without validating the error message. PR-URL: #10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
instead of silently overwriting invalid values with the default PR-URL: #10692 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michal Zasso <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
tests
Notes: this is a subset of the changes in #9031 as requested by @mscdex and @targos.