Fix compareArray.js harness tests

Also a typo in one of the messages.
This commit is contained in:
Linus Groh 2024-09-27 10:24:36 +01:00 committed by Ms2ger
parent 72ff7d1269
commit f1a670ff59
4 changed files with 10 additions and 10 deletions

View File

@ -45,6 +45,6 @@ assert.compareArray = function(actual, expected, message) {
// The following prevents actual and expected from being iterated and evaluated
// more than once unless absolutely necessary.
if (!result) {
assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the the same contents. ${message}`);
assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the same contents. ${message}`);
}
};

View File

@ -28,11 +28,11 @@ function f() {
checkFormatOfAssertionMessage(() => {
assert.compareArray(arguments, [], 'arguments and []');
}, 'Expected [0, a, undefined] and [] to have the same contents. arguments and []');
}, 'Actual [0, a, undefined] and expected [] should have the same contents. arguments and []');
checkFormatOfAssertionMessage(() => {
assert.compareArray([], arguments, '[] and arguments');
}, 'Expected [] and [0, a, undefined] to have the same contents. [] and arguments');
}, 'Actual [] and expected [0, a, undefined] should have the same contents. [] and arguments');
}
f(...fixture);

View File

@ -27,8 +27,8 @@ assert.compareArray([0, 'a', undefined], fixture);
checkFormatOfAssertionMessage(() => {
assert.compareArray(fixture, [], 'fixture and []');
}, 'Expected [0, a, undefined] and [] to have the same contents. fixture and []');
}, 'Actual [0, a, undefined] and expected [] should have the same contents. fixture and []');
checkFormatOfAssertionMessage(() => {
assert.compareArray([], fixture, '[] and fixture');
}, 'Expected [] and [0, a, undefined] to have the same contents. [] and fixture');
}, 'Actual [] and expected [0, a, undefined] should have the same contents. [] and fixture');

View File

@ -20,9 +20,9 @@ function assertThrows(func, errorMessage) {
assert(caught, `Expected ${func} to throw, but it didn't.`);
}
assertThrows(() => assert.compareArray(), "First argument shouldn't be nullish. ");
assertThrows(() => assert.compareArray(null, []), "First argument shouldn't be nullish. ");
assertThrows(() => assert.compareArray(null, [], "foo"), "First argument shouldn't be nullish. foo");
assertThrows(() => assert.compareArray(), "Actual argument shouldn't be nullish. ");
assertThrows(() => assert.compareArray(null, []), "Actual argument shouldn't be nullish. ");
assertThrows(() => assert.compareArray(null, [], "foo"), "Actual argument shouldn't be nullish. foo");
assertThrows(() => assert.compareArray([]), "Second argument shouldn't be nullish. ");
assertThrows(() => assert.compareArray([], undefined, "foo"), "Second argument shouldn't be nullish. foo");
assertThrows(() => assert.compareArray([]), "Expected argument shouldn't be nullish. ");
assertThrows(() => assert.compareArray([], undefined, "foo"), "Expected argument shouldn't be nullish. foo");