Skip to content

Commit e6c9868

Browse files
ivankraptomato
authored andcommitted
Downgrade ES6+ syntax in a couple of key harness files
Replace template literals with equivalent string concatenation in assert.js and remove the trailing argument comma in propertyHelper.js. This makes the harness ES5-friendlier and allows nearly a third of the tests to pass on old ES5 engines from a baseline of ~8.7% of all negative cases - assert.js is a key blocker.
1 parent d961145 commit e6c9868

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

harness/assert.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ assert.compareArray = function (actual, expected, message) {
113113
}
114114

115115
if (isPrimitive(actual)) {
116-
assert(false, `Actual argument [${actual}] shouldn't be primitive. ${message}`);
116+
assert(false, "Actual argument [" + actual + "] shouldn't be primitive. " + String(message));
117117
} else if (isPrimitive(expected)) {
118-
assert(false, `Expected argument [${expected}] shouldn't be primitive. ${message}`);
118+
assert(false, "Expected argument [" + expected + "] shouldn't be primitive. " + String(message));
119119
}
120120
var result = compareArray(actual, expected);
121121
if (result) return;
122122

123123
var format = compareArray.format;
124-
assert(false, `Actual ${format(actual)} and expected ${format(expected)} should have the same contents. ${message}`);
124+
assert(false, "Actual " + format(actual) + " and expected " + format(expected) + " should have the same contents. " + String(message));
125125
};
126126

127127
function compareArray(a, b) {
@@ -137,15 +137,15 @@ function compareArray(a, b) {
137137
}
138138

139139
compareArray.format = function (arrayLike) {
140-
return `[${Array.prototype.map.call(arrayLike, String).join(', ')}]`;
140+
return "[" + Array.prototype.map.call(arrayLike, String).join(", ") + "]";
141141
};
142142

143143
assert._formatIdentityFreeValue = function formatIdentityFreeValue(value) {
144144
switch (value === null ? 'null' : typeof value) {
145145
case 'string':
146-
return typeof JSON !== "undefined" ? JSON.stringify(value) : `"${value}"`;
146+
return typeof JSON !== "undefined" ? JSON.stringify(value) : '"' + value + '"';
147147
case 'bigint':
148-
return `${value}n`;
148+
return String(value) + "n";
149149
case 'number':
150150
if (value === 0 && 1 / value === -Infinity) return '-0';
151151
// falls through

harness/propertyHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function verifyProperty(obj, name, desc, options) {
8686
names[i] === "configurable" ||
8787
names[i] === "get" ||
8888
names[i] === "set",
89-
"Invalid descriptor field: " + names[i],
89+
"Invalid descriptor field: " + names[i]
9090
);
9191
}
9292

0 commit comments

Comments
 (0)