Don't construct unnecessarily asymmetricEqualityTesterArgCompatShims
This speeds up MatchersUtil#equals by about 6-7x.
This commit is contained in:
@@ -30,4 +30,25 @@ describe('base helpers', function() {
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isAsymmetricEqualityTester_', function() {
|
||||
it('returns false when the argument is falsy', function() {
|
||||
expect(jasmineUnderTest.isAsymmetricEqualityTester_(null)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false when the argument does not have a asymmetricMatch property', function() {
|
||||
var obj = {};
|
||||
expect(jasmineUnderTest.isAsymmetricEqualityTester_(obj)).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when the argument's asymmetricMatch is not a function", function() {
|
||||
var obj = { asymmetricMatch: 'yes' };
|
||||
expect(jasmineUnderTest.isAsymmetricEqualityTester_(obj)).toBe(false);
|
||||
});
|
||||
|
||||
it("returns true when the argument's asymmetricMatch is a function", function() {
|
||||
var obj = { asymmetricMatch: function() {} };
|
||||
expect(jasmineUnderTest.isAsymmetricEqualityTester_(obj)).toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user