mirror of https://github.com/tc39/test262.git
Fix compareArray.js harness tests
Also a typo in one of the messages.
This commit is contained in:
parent
72ff7d1269
commit
f1a670ff59
|
@ -45,6 +45,6 @@ assert.compareArray = function(actual, expected, message) {
|
||||||
// The following prevents actual and expected from being iterated and evaluated
|
// The following prevents actual and expected from being iterated and evaluated
|
||||||
// more than once unless absolutely necessary.
|
// more than once unless absolutely necessary.
|
||||||
if (!result) {
|
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}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,11 +28,11 @@ function f() {
|
||||||
|
|
||||||
checkFormatOfAssertionMessage(() => {
|
checkFormatOfAssertionMessage(() => {
|
||||||
assert.compareArray(arguments, [], 'arguments and []');
|
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(() => {
|
checkFormatOfAssertionMessage(() => {
|
||||||
assert.compareArray([], arguments, '[] and arguments');
|
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);
|
f(...fixture);
|
||||||
|
|
|
@ -27,8 +27,8 @@ assert.compareArray([0, 'a', undefined], fixture);
|
||||||
|
|
||||||
checkFormatOfAssertionMessage(() => {
|
checkFormatOfAssertionMessage(() => {
|
||||||
assert.compareArray(fixture, [], 'fixture and []');
|
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(() => {
|
checkFormatOfAssertionMessage(() => {
|
||||||
assert.compareArray([], fixture, '[] and fixture');
|
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');
|
||||||
|
|
|
@ -20,9 +20,9 @@ function assertThrows(func, errorMessage) {
|
||||||
assert(caught, `Expected ${func} to throw, but it didn't.`);
|
assert(caught, `Expected ${func} to throw, but it didn't.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
assertThrows(() => assert.compareArray(), "First argument shouldn't be nullish. ");
|
assertThrows(() => assert.compareArray(), "Actual argument shouldn't be nullish. ");
|
||||||
assertThrows(() => assert.compareArray(null, []), "First argument shouldn't be nullish. ");
|
assertThrows(() => assert.compareArray(null, []), "Actual argument shouldn't be nullish. ");
|
||||||
assertThrows(() => assert.compareArray(null, [], "foo"), "First argument shouldn't be nullish. foo");
|
assertThrows(() => assert.compareArray(null, [], "foo"), "Actual argument shouldn't be nullish. foo");
|
||||||
|
|
||||||
assertThrows(() => assert.compareArray([]), "Second argument shouldn't be nullish. ");
|
assertThrows(() => assert.compareArray([]), "Expected argument shouldn't be nullish. ");
|
||||||
assertThrows(() => assert.compareArray([], undefined, "foo"), "Second argument shouldn't be nullish. foo");
|
assertThrows(() => assert.compareArray([], undefined, "foo"), "Expected argument shouldn't be nullish. foo");
|
||||||
|
|
Loading…
Reference in New Issue