Change message for extra elements at end of actual array. #1485
This commit is contained in:
@@ -225,8 +225,14 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
});
|
||||
|
||||
for (i = 0; i < aLength || i < bLength; i++) {
|
||||
var formatter = false;
|
||||
diffBuilder.withPath(i, function() {
|
||||
result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack, customTesters, diffBuilder) && result;
|
||||
if (i >= bLength) {
|
||||
diffBuilder.record(a[i], void 0, actualArrayIsLongerFormatter);
|
||||
result = false;
|
||||
} else {
|
||||
result = eq(i < aLength ? a[i] : void 0, i < bLength ? b[i] : void 0, aStack, bStack, customTesters, diffBuilder) && result;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!result) {
|
||||
@@ -452,6 +458,13 @@ getJasmineRequireObj().matchersUtil = function(j$) {
|
||||
', but was ' + j$.pp(actual) + '.';
|
||||
}
|
||||
|
||||
function actualArrayIsLongerFormatter(actual, expected, path) {
|
||||
return 'Unexpected ' +
|
||||
path + (path.depth() ? ' = ' : '') +
|
||||
j$.pp(actual) +
|
||||
' in array.';
|
||||
}
|
||||
|
||||
function formatKeyValuePairs(obj) {
|
||||
var formatted = '';
|
||||
for (var key in obj) {
|
||||
|
||||
Reference in New Issue
Block a user