Improve assertion handling when comparison causes failure via coercion

This commit is contained in:
Rick Waldron 2018-10-23 17:25:58 -04:00
parent f247a5fe09
commit ee3715ee56

View File

@ -27,9 +27,14 @@ assert._isSameValue = function (a, b) {
}; };
assert.sameValue = function (actual, expected, message) { assert.sameValue = function (actual, expected, message) {
try {
if (assert._isSameValue(actual, expected)) { if (assert._isSameValue(actual, expected)) {
return; return;
} }
} catch (error) {
$ERROR(message + ' (_isSameValue operation threw) ' + error);
return;
}
if (message === undefined) { if (message === undefined) {
message = ''; message = '';