mirror of https://github.com/tc39/test262.git
Don't call assert.deepEqual.format when the assertion will succeed
This commit is contained in:
parent
c3cbc32745
commit
900c80295e
|
@ -8,10 +8,15 @@ defines: [assert.deepEqual]
|
|||
|
||||
assert.deepEqual = function(actual, expected, message) {
|
||||
var format = assert.deepEqual.format;
|
||||
assert(
|
||||
assert.deepEqual._compare(actual, expected),
|
||||
`Expected ${format(actual)} to be structurally equal to ${format(expected)}. ${(message || '')}`
|
||||
);
|
||||
var mustBeTrue = assert.deepEqual._compare(actual, expected);
|
||||
|
||||
// format can be slow when `actual` or `expected` are large objects, like for
|
||||
// example the global object, so only call it when the assertion will fail.
|
||||
if (mustBeTrue !== true) {
|
||||
message = `Expected ${format(actual)} to be structurally equal to ${format(expected)}. ${(message || '')}`;
|
||||
}
|
||||
|
||||
assert(mustBeTrue, message);
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
Loading…
Reference in New Issue