Evaluate custom equality testers before any others.
This commit is contained in:
12
src/Env.js
12
src/Env.js
@@ -181,6 +181,12 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
||||
mismatchKeys = mismatchKeys || [];
|
||||
mismatchValues = mismatchValues || [];
|
||||
|
||||
for (var i = 0; i < this.equalityTesters_.length; i++) {
|
||||
var equalityTester = this.equalityTesters_[i];
|
||||
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
|
||||
if (result !== jasmine.undefined) return result;
|
||||
}
|
||||
|
||||
if (a === b) return true;
|
||||
|
||||
if (a === jasmine.undefined || a === null || b === jasmine.undefined || b === null) {
|
||||
@@ -207,12 +213,6 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
||||
return this.compareObjects_(a, b, mismatchKeys, mismatchValues);
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.equalityTesters_.length; i++) {
|
||||
var equalityTester = this.equalityTesters_[i];
|
||||
var result = equalityTester(a, b, this, mismatchKeys, mismatchValues);
|
||||
if (result !== jasmine.undefined) return result;
|
||||
}
|
||||
|
||||
//Straight check
|
||||
return (a === b);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user