mirror of
https://github.com/tc39/test262.git
synced 2025-07-25 23:14:47 +02:00
fix: ensure that symbol args as message don't break assert.compareArray
This commit is contained in:
parent
12e9d67bb5
commit
addfd8bf3d
@ -32,6 +32,11 @@ compareArray.format = function(arrayLike) {
|
|||||||
|
|
||||||
assert.compareArray = function(actual, expected, message) {
|
assert.compareArray = function(actual, expected, message) {
|
||||||
message = message === undefined ? '' : message;
|
message = message === undefined ? '' : message;
|
||||||
|
|
||||||
|
if (typeof message === 'symbol') {
|
||||||
|
message = message.toString();
|
||||||
|
}
|
||||||
|
|
||||||
assert(actual != null, `First argument shouldn't be nullish. ${message}`);
|
assert(actual != null, `First argument shouldn't be nullish. ${message}`);
|
||||||
assert(expected != null, `Second argument shouldn't be nullish. ${message}`);
|
assert(expected != null, `Second argument shouldn't be nullish. ${message}`);
|
||||||
var format = compareArray.format;
|
var format = compareArray.format;
|
||||||
|
23
test/harness/compare-array-message.js
Normal file
23
test/harness/compare-array-message.js
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Copyright (C) 2021 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
description: >
|
||||||
|
compareArray can handle any value in message arg
|
||||||
|
includes: [compareArray.js]
|
||||||
|
features: [BigInt, Symbol]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
assert.compareArray([], [], true);
|
||||||
|
assert.compareArray([], [], 1);
|
||||||
|
assert.compareArray([], [], 1n);
|
||||||
|
assert.compareArray([], [], () => {});
|
||||||
|
assert.compareArray([], [], "test262");
|
||||||
|
assert.compareArray([], [], Symbol("1"));
|
||||||
|
assert.compareArray([], [], {});
|
||||||
|
assert.compareArray([], [], []);
|
||||||
|
assert.compareArray([], [], -1);
|
||||||
|
assert.compareArray([], [], Infinity);
|
||||||
|
assert.compareArray([], [], -Infinity);
|
||||||
|
assert.compareArray([], [], 0.1);
|
||||||
|
assert.compareArray([], [], -0.1);
|
Loading…
x
Reference in New Issue
Block a user