-
-
Notifications
You must be signed in to change notification settings - Fork 35k
assert: respect assert.doesNotThrow message. #2407
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
Closed
diversario
wants to merge
4
commits into
nodejs:master
from
diversario:fix/2385-inconsistency-in-assert-doesnotthrow
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
83ec4b5
assert: respect assert.doesNotThrow message.
d741140
assert: clean up conditional for _throws, fix docs.
diversario f3eac76
assert: reformat docs, use const, refactor a test
diversario 610a38e
assert: fix linter error in test-assert.js
diversario File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
assert: respect assert.doesNotThrow message.
Addresses #2385. Special handling to detect when user has supplied a custom message. Added a test for user message. When testing if `actual` value is an error use `util.isError` instead of `instanceof`.
- Loading branch information
commit 83ec4b5cdc2004a88d608137a46d01897e2e7f6d
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -321,6 +321,13 @@ assert.throws(function() {assert.ifError(new Error('test error'));}); | |
| assert.doesNotThrow(function() {assert.ifError(null);}); | ||
| assert.doesNotThrow(function() {assert.ifError();}); | ||
|
|
||
| try { | ||
| assert.doesNotThrow(makeBlock(thrower, Error), 'user message'); | ||
| } catch(e) { | ||
| assert.equal(e.message, 'Got unwanted exception. user message', | ||
| 'a.doesNotThrow ignores user message'); | ||
| } | ||
|
|
||
|
||
| // make sure that validating using constructor really works | ||
| threw = false; | ||
| try { | ||
|
|
||
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.
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.
I'd prefer to see a more liberal use of parens to make it explicit what the evaluation order is that you're using here, mixing
&&and||without parens makes this very difficult to parse. The number of conditions in here adds to that difficulty and it'd be nice to reduce it with some compacting variables—although not essential, just would be nice to make this less terse.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.
Breaking out the
||part into a var sounds good.