Uh oh!
There was an error while loading. Please reload this page.
assert: fix internal logic judgment - #27743
Conversation
zero1five
commented
May 18, 2019
review wanted. |
Uh oh!
There was an error while loading. Please reload this page.
Trott
commented
May 19, 2019
BridgeAR
left a comment
There was a problem hiding this comment.
The code change does not seem right to me. All added test cases work identical as before with this patch besides the last one which should ideally print 'Failed' which it currently does.
The documentation could use an update though. My plane is about to take off so I'll review that later.
cde5202 to
dfe1904Comparerefack
commented
May 19, 2019
Hello @zero1five, and thank you for the contribution! |
@zero1five |
dfe1904 to
9553cafComparezero1five
commented
May 20, 2019
@BridgeAR Thank you very much for your review! I made some changes, can you please review it? |
7cb6eb0 to
f8314d6Compare
BridgeAR
left a comment
There was a problem hiding this comment.
Thanks for sticking to it! I left a few more comments.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
f8314d6 to
7994c95CompareFix the logic judgment of assert.fail and add doc and the test cases for the performance of assert.fail on multiple parameter.
5534055 to
b87a772CompareBridgeAR
commented
Jan 12, 2020
@zero1five sorry that it took a while to look at this again. Some times it's difficult to keep an overview over all the PRs. This needs a rebase but I think this should otherwise be good to go. @Trott would you please take another look at the docs? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| given, the default message `Failed` will be used. | ||
| `expected` separated by the provided `operator`. If `operator` is falsy and no | ||
| message is set, it'll default to `'!='`. If `message` is truthy the `operator` | ||
| will default to `'fail'` and `message` will be used as error message. Other |
There was a problem hiding this comment.
| will default to `'fail'` and `message` will be used as error message. Other | |
| will default to `'fail'` and `message` will be used for the error message. Other |
Uh oh!
There was an error while loading. Please reload this page.
Trott
commented
Jan 26, 2020
I left some suggestions but they're all nits, This can land without them,. |
| actual: undefined, | ||
| expected: undefined, | ||
| generatedMessage: true | ||
| }); |
There was a problem hiding this comment.
This test currently passes without the other changes in this PR. Can we please add a test case that currently fails?
HarshithaKP
commented
Apr 24, 2020
@zero1five, there are few review comments and this needs a rebase. |
| if (message instanceof Error) throw message; | ||
| if (operator === undefined) { | ||
| if (message) { |
There was a problem hiding this comment.
| if(message){ | |
| if(message!=null){ |
| assert.fail(undefined); | ||
| }, { | ||
| code: 'ERR_ASSERTION', | ||
| name: 'AssertionError', | ||
| message: 'Failed', | ||
| operator: 'fail', | ||
| actual: undefined, | ||
| expected: undefined, |
There was a problem hiding this comment.
| assert.fail(undefined); | |
| },{ | |
| code: 'ERR_ASSERTION', | |
| name: 'AssertionError', | |
| message: 'Failed', | |
| operator: 'fail', | |
| actual: undefined, | |
| expected: undefined, | |
| assert.fail(1,2,undefined,undefined); | |
| },{ | |
| code: 'ERR_ASSERTION', | |
| name: 'AssertionError', | |
| message: '1 != 2', | |
| operator: '!=', | |
| actual: 1, | |
| expected: 2, |
Ideally, another identical test could be added that sets message to null.
| `expected` separated by the provided `operator`. If `operator` is falsy and no | ||
| message is set, it will default to `'!='`. If `message` is truthy, the `operator` | ||
| will default to `'fail'` and `message` will be used for the error message. Other | ||
| arguments will be stored as properties on the thrown object. If `stackStartFn` | ||
| is provided, all stack frames above that function will be removed from | ||
| stacktrace (see [`Error.captureStackTrace`][]). |
There was a problem hiding this comment.
I suggest to change the operator description above to explain when it's set to 'fail' and when to '!='.
I would also move the stackStartFn description to the part above. That way the total description below concentrates on the general behavior instead of describing each individual option setting.
Right now we also miss to document that assert.fail(1, 2, new Error() throws the passed through error. That could be described in the message property above.
The comments should be addressed before this lands.
8ae28ff to
2935f72Comparejasnell
commented
Jul 7, 2020
This would need a rebase in order to move forward |
Fix the logic judgment of assert.fail and add doc
and the test cases for the performance of assert.fail
on multiple parameter.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes