diff --git a/packages/core-js/internals/object-assign.js b/packages/core-js/internals/object-assign.js index de1c6e2686b0..1a8947b0d8ef 100644 --- a/packages/core-js/internals/object-assign.js +++ b/packages/core-js/internals/object-assign.js @@ -32,7 +32,7 @@ module.exports = !$assign || fails(function () { var A = {}; var B = {}; // eslint-disable-next-line es/no-symbol -- safe - var symbol = Symbol(); + var symbol = Symbol('assign detection'); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); diff --git a/packages/core-js/internals/symbol-constructor-detection.js b/packages/core-js/internals/symbol-constructor-detection.js index 835bc9939002..d77be0714b14 100644 --- a/packages/core-js/internals/symbol-constructor-detection.js +++ b/packages/core-js/internals/symbol-constructor-detection.js @@ -8,7 +8,7 @@ var $String = global.String; // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing module.exports = !!Object.getOwnPropertySymbols && !fails(function () { - var symbol = Symbol(); + var symbol = Symbol('symbol detection'); // Chrome 38 Symbol has incorrect toString conversion // `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances // nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will, diff --git a/packages/core-js/modules/es.json.stringify.js b/packages/core-js/modules/es.json.stringify.js index 7d73aa5a00f2..3c62efc1857f 100644 --- a/packages/core-js/modules/es.json.stringify.js +++ b/packages/core-js/modules/es.json.stringify.js @@ -24,7 +24,7 @@ var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var WRONG_SYMBOLS_CONVERSION = !NATIVE_SYMBOL || fails(function () { - var symbol = getBuiltIn('Symbol')(); + var symbol = getBuiltIn('Symbol')('stringify detection'); // MS Edge converts symbol values to JSON as {} return $stringify([symbol]) !== '[null]' // WebKit converts symbol values to JSON as null diff --git a/packages/core-js/modules/es.symbol.description.js b/packages/core-js/modules/es.symbol.description.js index ce2863fd6976..4f36b504e59d 100644 --- a/packages/core-js/modules/es.symbol.description.js +++ b/packages/core-js/modules/es.symbol.description.js @@ -35,7 +35,7 @@ if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototy SymbolWrapper.prototype = SymbolPrototype; SymbolPrototype.constructor = SymbolWrapper; - var NATIVE_SYMBOL = String(NativeSymbol('test')) === 'Symbol(test)'; + var NATIVE_SYMBOL = String(NativeSymbol('description detection')) === 'Symbol(description detection)'; var thisSymbolValue = uncurryThis(SymbolPrototype.valueOf); var symbolDescriptiveString = uncurryThis(SymbolPrototype.toString); var regexp = /^Symbol\((.*)\)[^)]+$/; diff --git a/tests/compat/tests.js b/tests/compat/tests.js index c5aa244c1e0e..5b24c98b4160 100644 --- a/tests/compat/tests.js +++ b/tests/compat/tests.js @@ -84,7 +84,7 @@ var PROMISE_STATICS_ITERATION = function () { }; var SYMBOLS_SUPPORT = function () { - return Object.getOwnPropertySymbols && String(Symbol()) && !(V8_VERSION && V8_VERSION < 41); + return Object.getOwnPropertySymbols && String(Symbol('symbol detection')) && !(V8_VERSION && V8_VERSION < 41); }; var SYMBOL_REGISTRY = [SYMBOLS_SUPPORT, function () { @@ -281,18 +281,20 @@ function TIMERS() { GLOBAL.tests = { // TODO: Remove this module from `core-js@4` since it's split to modules listed below 'es.symbol': [SYMBOLS_SUPPORT, function () { + var symbol = Symbol('stringify detection'); return Object.getOwnPropertySymbols('qwe') && Symbol['for'] && Symbol.keyFor - && JSON.stringify([Symbol()]) === '[null]' - && JSON.stringify({ a: Symbol() }) === '{}' - && JSON.stringify(Object(Symbol())) === '{}' + && JSON.stringify([symbol]) === '[null]' + && JSON.stringify({ a: symbol }) === '{}' + && JSON.stringify(Object(symbol)) === '{}' && Symbol.prototype[Symbol.toPrimitive] && Symbol.prototype[Symbol.toStringTag]; }], 'es.symbol.constructor': SYMBOLS_SUPPORT, 'es.symbol.description': function () { - return Symbol('foo').description === 'foo' && Symbol().description === undefined; + // eslint-disable-next-line symbol-description -- required for testing + return Symbol('description detection').description === 'description detection' && Symbol().description === undefined; }, 'es.symbol.async-iterator': function () { return Symbol.asyncIterator; @@ -663,9 +665,10 @@ GLOBAL.tests = { return globalThis; }, 'es.json.stringify': [SYMBOLS_SUPPORT, function () { - return JSON.stringify([Symbol()]) === '[null]' - && JSON.stringify({ a: Symbol() }) === '{}' - && JSON.stringify(Object(Symbol())) === '{}' + var symbol = Symbol('stringify detection'); + return JSON.stringify([symbol]) === '[null]' + && JSON.stringify({ a: symbol }) === '{}' + && JSON.stringify(Object(symbol)) === '{}' && JSON.stringify('\uDF06\uD834') === '"\\udf06\\ud834"' && JSON.stringify('\uDEAD') === '"\\udead"'; }], @@ -836,7 +839,7 @@ GLOBAL.tests = { }), { b: 2 })).b !== 1) return false; var A = {}; var B = {}; - var symbol = Symbol(); + var symbol = Symbol('assign detection'); var alphabet = 'abcdefghijklmnopqrst'; A[symbol] = 7; alphabet.split('').forEach(function (chr) { B[chr] = chr; }); diff --git a/tests/entries/unit.mjs b/tests/entries/unit.mjs index 4ac2ba2892ba..ffeebaf89cc2 100644 --- a/tests/entries/unit.mjs +++ b/tests/entries/unit.mjs @@ -25,7 +25,7 @@ for (PATH of ['core-js-pure', 'core-js']) { ok(load(NS, 'object/freeze')({})); ok(load(NS, 'object/get-own-property-descriptor')({ q: 1 }, 'q').enumerable); ok(load(NS, 'object/get-own-property-names')({ q: 42 })[0] === 'q'); - ok(load(NS, 'object/get-own-property-symbols')({ [Symbol()]: 42 }).length === 1); + ok(load(NS, 'object/get-own-property-symbols')({ [Symbol('getOwnPropertySymbols test')]: 42 }).length === 1); ok(load(NS, 'object/get-prototype-of')([]) === Array.prototype); ok(load(NS, 'object/has-own')({ foo: 42 }, 'foo')); ok(load(NS, 'object/is')(NaN, NaN)); diff --git a/tests/eslint/eslint.config.js b/tests/eslint/eslint.config.js index ede8234b683e..7b8fe109f608 100644 --- a/tests/eslint/eslint.config.js +++ b/tests/eslint/eslint.config.js @@ -289,6 +289,8 @@ const base = { }], // require strict mode directives strict: [ERROR, 'global'], + // require symbol descriptions + 'symbol-description': ERROR, // disallow "Yoda" conditions yoda: [ERROR, NEVER], diff --git a/tests/unit-global/es.aggregate-error.js b/tests/unit-global/es.aggregate-error.js index 8ba2c1ec12bb..3e1bfc79042d 100644 --- a/tests/unit-global/es.aggregate-error.js +++ b/tests/unit-global/es.aggregate-error.js @@ -13,7 +13,7 @@ QUnit.test('AggregateError', assert => { assert.same(AggregateError([1], 123).message, '123'); assert.same(AggregateError([1]).message, ''); assert.deepEqual(AggregateError([1, 2, 3]).errors, [1, 2, 3]); - assert.throws(() => AggregateError([1], Symbol()), 'throws on symbol as a message'); + assert.throws(() => AggregateError([1], Symbol('AggregateError test')), 'throws on symbol as a message'); assert.same(({}).toString.call(AggregateError([1])), '[object Error]', 'Object#toString'); assert.same(AggregateError.prototype.constructor, AggregateError, 'prototype constructor'); diff --git a/tests/unit-global/es.escape.js b/tests/unit-global/es.escape.js index 8b067c40b71e..aa79bc6504f7 100644 --- a/tests/unit-global/es.escape.js +++ b/tests/unit-global/es.escape.js @@ -8,6 +8,6 @@ QUnit.test('escape', assert => { assert.same(escape(undefined), 'undefined'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => unescape(Symbol()), 'throws on symbol argument'); + assert.throws(() => unescape(Symbol('escape test')), 'throws on symbol argument'); } }); diff --git a/tests/unit-global/es.json.stringify.js b/tests/unit-global/es.json.stringify.js index 62f01220724f..78aeb8988d4b 100644 --- a/tests/unit-global/es.json.stringify.js +++ b/tests/unit-global/es.json.stringify.js @@ -142,7 +142,7 @@ if (GLOBAL.JSON?.stringify) { assert.same(stringify(obj4, null), json1, 'replacer-wrong-type-4'); assert.same(stringify(obj4, ''), json1, 'replacer-wrong-type-5'); assert.same(stringify(obj4, 0), json1, 'replacer-wrong-type-6'); - assert.same(stringify(obj4, Symbol()), json1, 'replacer-wrong-type-7'); + assert.same(stringify(obj4, Symbol('stringify replacer test')), json1, 'replacer-wrong-type-7'); assert.same(stringify(obj4, true), json1, 'replacer-wrong-type-8'); const obj5 = { @@ -208,7 +208,7 @@ if (GLOBAL.JSON?.stringify) { assert.same(stringify(obj5), stringify(obj5, null, null), 'space-wrong-type-1'); assert.same(stringify(obj5), stringify(obj5, null, true), 'space-wrong-type-2'); assert.same(stringify(obj5), stringify(obj5, null, new Boolean(false)), 'space-wrong-type-3'); - assert.same(stringify(obj5), stringify(obj5, null, Symbol()), 'space-wrong-type-4'); + assert.same(stringify(obj5), stringify(obj5, null, Symbol('stringify space test')), 'space-wrong-type-4'); assert.same(stringify(obj5), stringify(obj5, null, {}), 'space-wrong-type-5'); const direct2 = []; @@ -486,24 +486,27 @@ if (GLOBAL.JSON?.stringify) { QUnit.test('Symbols & JSON.stringify', assert => { const { stringify } = JSON; + const symbol1 = Symbol('symbol & stringify test 1'); + const symbol2 = Symbol('symbol & stringify test 2'); + assert.same(stringify([ 1, - Symbol('foo'), + symbol1, false, - Symbol('bar'), + symbol2, {}, ]), '[1,null,false,null,{}]', 'array value'); assert.same(stringify({ - symbol: Symbol('symbol'), + symbol: symbol1, }), '{}', 'object value'); if (DESCRIPTORS) { const object = { bar: 2 }; - object[Symbol('symbol')] = 1; + object[symbol1] = 1; assert.same(stringify(object), '{"bar":2}', 'object key'); } - assert.same(stringify(Symbol('symbol')), undefined, 'symbol value'); - if (typeof Symbol() == 'symbol') { - assert.same(stringify(Object(Symbol('symbol'))), '{}', 'boxed symbol'); + assert.same(stringify(symbol1), undefined, 'symbol value'); + if (typeof symbol1 == 'symbol') { + assert.same(stringify(Object(symbol1)), '{}', 'boxed symbol'); } assert.same(stringify(undefined, () => 42), '42', 'replacer works with top-level undefined'); }); diff --git a/tests/unit-global/es.number.constructor.js b/tests/unit-global/es.number.constructor.js index 2f2828b04985..65f7a2123e7d 100644 --- a/tests/unit-global/es.number.constructor.js +++ b/tests/unit-global/es.number.constructor.js @@ -161,8 +161,9 @@ QUnit.test('Number constructor: regression', assert => { }), TypeError, 'new Number assert.throws on object then valueOf and toString are not functions'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => Number(Symbol()), 'throws on symbol argument'); - assert.throws(() => new Number(Symbol()), 'throws on symbol argument, new'); + const symbol = Symbol('Number constructor test'); + assert.throws(() => Number(symbol), 'throws on symbol argument'); + assert.throws(() => new Number(symbol), 'throws on symbol argument, new'); } number = new Number(42); diff --git a/tests/unit-global/es.number.parse-float.js b/tests/unit-global/es.number.parse-float.js index 68532488f878..d3ccc5247375 100644 --- a/tests/unit-global/es.number.parse-float.js +++ b/tests/unit-global/es.number.parse-float.js @@ -20,7 +20,8 @@ QUnit.test('Number.parseFloat', assert => { assert.same(parseFloat(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => parseFloat(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseFloat(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('Number.parseFloat test'); + assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); + assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-global/es.number.parse-int.js b/tests/unit-global/es.number.parse-int.js index bb1f341695db..f464864f03c3 100644 --- a/tests/unit-global/es.number.parse-int.js +++ b/tests/unit-global/es.number.parse-int.js @@ -38,7 +38,8 @@ QUnit.test('Number.parseInt', assert => { assert.same(parseInt(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => parseInt(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseInt(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('Number.parseInt test'); + assert.throws(() => parseInt(symbol), 'throws on symbol argument'); + assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-global/es.object.get-own-property-symbols.js b/tests/unit-global/es.object.get-own-property-symbols.js index 812d73c42dbc..a7e7a3b0fadb 100644 --- a/tests/unit-global/es.object.get-own-property-symbols.js +++ b/tests/unit-global/es.object.get-own-property-symbols.js @@ -11,15 +11,15 @@ QUnit.test('Object.getOwnPropertySymbols', assert => { assert.name(getOwnPropertySymbols, 'getOwnPropertySymbols'); assert.looksNative(getOwnPropertySymbols); const prototype = { q: 1, w: 2, e: 3 }; - prototype[Symbol()] = 42; - prototype[Symbol()] = 43; + prototype[Symbol('getOwnPropertySymbols test 1')] = 42; + prototype[Symbol('getOwnPropertySymbols test 2')] = 43; assert.deepEqual(getOwnPropertyNames(prototype).sort(), ['e', 'q', 'w']); assert.same(getOwnPropertySymbols(prototype).length, 2); const object = create(prototype); object.a = 1; object.s = 2; object.d = 3; - object[Symbol()] = 44; + object[Symbol('getOwnPropertySymbols test 3')] = 44; assert.deepEqual(getOwnPropertyNames(object).sort(), ['a', 'd', 's']); assert.same(getOwnPropertySymbols(object).length, 1); assert.same(getOwnPropertySymbols(Object.prototype).length, 0); diff --git a/tests/unit-global/es.parse-float.js b/tests/unit-global/es.parse-float.js index dc73dde39c38..34b1d23a56b9 100644 --- a/tests/unit-global/es.parse-float.js +++ b/tests/unit-global/es.parse-float.js @@ -17,7 +17,8 @@ QUnit.test('parseFloat', assert => { assert.same(parseFloat(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => parseFloat(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseFloat(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('parseFloat test'); + assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); + assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-global/es.parse-int.js b/tests/unit-global/es.parse-int.js index 5def55599763..905235640410 100644 --- a/tests/unit-global/es.parse-int.js +++ b/tests/unit-global/es.parse-int.js @@ -36,8 +36,9 @@ QUnit.test('parseInt', assert => { assert.same(parseInt(undefined), NaN); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => parseInt(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseInt(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('parseInt test'); + assert.throws(() => parseInt(symbol), 'throws on symbol argument'); + assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-global/es.regexp.exec.js b/tests/unit-global/es.regexp.exec.js index 1a68b00a9109..19af12cf8fa9 100644 --- a/tests/unit-global/es.regexp.exec.js +++ b/tests/unit-global/es.regexp.exec.js @@ -32,7 +32,7 @@ QUnit.test('RegExp#exec capturing groups', assert => { if (DESCRIPTORS) { QUnit.test('RegExp#exec regression', assert => { - assert.throws(() => /l/.exec(Symbol()), 'throws on symbol argument'); + assert.throws(() => /l/.exec(Symbol('RegExp#exec test')), 'throws on symbol argument'); }); QUnit.test('RegExp#exec sticky', assert => { diff --git a/tests/unit-global/es.regexp.to-string.js b/tests/unit-global/es.regexp.to-string.js index 4e70af58f95e..f729026cbc4a 100644 --- a/tests/unit-global/es.regexp.to-string.js +++ b/tests/unit-global/es.regexp.to-string.js @@ -32,7 +32,7 @@ QUnit.test('RegExp#toString', assert => { } assert.throws(() => toString.call({ - source: Symbol(), + source: Symbol('RegExp#toString test'), flags: 'g', }), 'throws on symbol'); }); diff --git a/tests/unit-global/es.string.anchor.js b/tests/unit-global/es.string.anchor.js index a4782f37fd52..d2e412bb8acd 100644 --- a/tests/unit-global/es.string.anchor.js +++ b/tests/unit-global/es.string.anchor.js @@ -9,7 +9,8 @@ QUnit.test('String#anchor', assert => { assert.same('a'.anchor('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => anchor.call(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => anchor.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('anchor test'); + assert.throws(() => anchor.call(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => anchor.call('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-global/es.string.at-alternative.js b/tests/unit-global/es.string.at-alternative.js index c38bae24307f..5bf68af08945 100644 --- a/tests/unit-global/es.string.at-alternative.js +++ b/tests/unit-global/es.string.at-alternative.js @@ -25,7 +25,7 @@ QUnit.test('String#at', assert => { // assert.same('\uD842', '𠮷'.at()); assert.same('1', at.call({ toString() { return '123'; } }, 0)); - assert.throws(() => at.call(Symbol(), 0), 'throws on symbol context'); + assert.throws(() => at.call(Symbol('at-alternative test'), 0), 'throws on symbol context'); if (STRICT) { assert.throws(() => at.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.big.js b/tests/unit-global/es.string.big.js index c69ff72f14ef..f2387c343b62 100644 --- a/tests/unit-global/es.string.big.js +++ b/tests/unit-global/es.string.big.js @@ -8,6 +8,6 @@ QUnit.test('String#big', assert => { assert.same('a'.big(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => big.call(Symbol()), 'throws on symbol context'); + assert.throws(() => big.call(Symbol('big test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.blink.js b/tests/unit-global/es.string.blink.js index 3e650392a01b..031c1585d377 100644 --- a/tests/unit-global/es.string.blink.js +++ b/tests/unit-global/es.string.blink.js @@ -8,6 +8,6 @@ QUnit.test('String#blink', assert => { assert.same('a'.blink(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => blink.call(Symbol()), 'throws on symbol context'); + assert.throws(() => blink.call(Symbol('blink test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.bold.js b/tests/unit-global/es.string.bold.js index e0920c3e2f25..65b917e8722a 100644 --- a/tests/unit-global/es.string.bold.js +++ b/tests/unit-global/es.string.bold.js @@ -8,6 +8,6 @@ QUnit.test('String#bold', assert => { assert.same('a'.bold(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => bold.call(Symbol()), 'throws on symbol context'); + assert.throws(() => bold.call(Symbol('bold test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.code-point-at.js b/tests/unit-global/es.string.code-point-at.js index 592de795f3b5..3191a858e942 100644 --- a/tests/unit-global/es.string.code-point-at.js +++ b/tests/unit-global/es.string.code-point-at.js @@ -58,7 +58,7 @@ QUnit.test('String#codePointAt', assert => { assert.same('\uDF06abc'.codePointAt(undefined), 0xDF06); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => codePointAt.call(Symbol(), 1), 'throws on symbol context'); + assert.throws(() => codePointAt.call(Symbol('codePointAt test'), 1), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-global/es.string.ends-with.js b/tests/unit-global/es.string.ends-with.js index 60b9e96936b7..2ffd9523bc79 100644 --- a/tests/unit-global/es.string.ends-with.js +++ b/tests/unit-global/es.string.ends-with.js @@ -24,8 +24,9 @@ QUnit.test('String#endsWith', assert => { assert.false('abc'.endsWith('a', 'x')); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => endsWith.call(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => endsWith.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('endsWith test'); + assert.throws(() => endsWith.call(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => endsWith.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-global/es.string.fixed.js b/tests/unit-global/es.string.fixed.js index 92b0ba4593b6..84a807fbdad5 100644 --- a/tests/unit-global/es.string.fixed.js +++ b/tests/unit-global/es.string.fixed.js @@ -8,6 +8,6 @@ QUnit.test('String#fixed', assert => { assert.same('a'.fixed(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => fixed.call(Symbol()), 'throws on symbol context'); + assert.throws(() => fixed.call(Symbol('fixed test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.fontcolor.js b/tests/unit-global/es.string.fontcolor.js index f2e9a502cabf..c09e564777c4 100644 --- a/tests/unit-global/es.string.fontcolor.js +++ b/tests/unit-global/es.string.fontcolor.js @@ -9,6 +9,6 @@ QUnit.test('String#fontcolor', assert => { assert.same('a'.fontcolor('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => fontcolor.call(Symbol()), 'throws on symbol context'); + assert.throws(() => fontcolor.call(Symbol('fontcolor test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.fontsize.js b/tests/unit-global/es.string.fontsize.js index 7e8ef9079d5c..a5b539a7bf42 100644 --- a/tests/unit-global/es.string.fontsize.js +++ b/tests/unit-global/es.string.fontsize.js @@ -9,7 +9,8 @@ QUnit.test('String#fontsize', assert => { assert.same('a'.fontsize('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => fontsize.call(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => fontsize.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('fontsize test'); + assert.throws(() => fontsize.call(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => fontsize.call('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-global/es.string.includes.js b/tests/unit-global/es.string.includes.js index a9ad5203799f..5c2e55541992 100644 --- a/tests/unit-global/es.string.includes.js +++ b/tests/unit-global/es.string.includes.js @@ -15,8 +15,9 @@ QUnit.test('String#includes', assert => { assert.false('abcd'.includes('b', 2)); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => includes.call(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => includes.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('includes test'); + assert.throws(() => includes.call(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => includes.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-global/es.string.is-well-formed.js b/tests/unit-global/es.string.is-well-formed.js index fb08d3bde064..f8560785bdfc 100644 --- a/tests/unit-global/es.string.is-well-formed.js +++ b/tests/unit-global/es.string.is-well-formed.js @@ -40,5 +40,5 @@ QUnit.test('String#isWellFormed', assert => { assert.throws(() => isWellFormed.call(undefined), TypeError, 'coercible #2'); } - assert.throws(() => isWellFormed.call(Symbol()), 'throws on symbol context'); + assert.throws(() => isWellFormed.call(Symbol('isWellFormed test')), 'throws on symbol context'); }); diff --git a/tests/unit-global/es.string.italics.js b/tests/unit-global/es.string.italics.js index f942d8ffc466..67b97629f7e3 100644 --- a/tests/unit-global/es.string.italics.js +++ b/tests/unit-global/es.string.italics.js @@ -8,6 +8,6 @@ QUnit.test('String#italics', assert => { assert.same('a'.italics(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => italics.call(Symbol()), 'throws on symbol context'); + assert.throws(() => italics.call(Symbol('italics test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.link.js b/tests/unit-global/es.string.link.js index 384faec12d1b..2b3bea265572 100644 --- a/tests/unit-global/es.string.link.js +++ b/tests/unit-global/es.string.link.js @@ -9,7 +9,8 @@ QUnit.test('String#link', assert => { assert.same('a'.link('"'), 'a', 'escape quotes'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => link.call(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => link.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('link test'); + assert.throws(() => link.call(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => link.call('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-global/es.string.match-all.js b/tests/unit-global/es.string.match-all.js index 26df31bfe42c..7b84eb007b2b 100644 --- a/tests/unit-global/es.string.match-all.js +++ b/tests/unit-global/es.string.match-all.js @@ -128,8 +128,9 @@ QUnit.test('String#matchAll', assert => { } if (DESCRIPTORS && typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => matchAll.call(Symbol(), /./), 'throws on symbol context'); - assert.throws(() => matchAll.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('matchAll test'); + assert.throws(() => matchAll.call(symbol, /./), 'throws on symbol context'); + assert.throws(() => matchAll.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-global/es.string.match.js b/tests/unit-global/es.string.match.js index b1fa43547d9a..2fc72f6a8015 100644 --- a/tests/unit-global/es.string.match.js +++ b/tests/unit-global/es.string.match.js @@ -187,7 +187,7 @@ const run = assert => { assert.same(''.match.call(number, regexp).index, 1, 'S15.5.4.10_A2_T18 #3'); assert.same(''.match.call(number, regexp).input, String(number), 'S15.5.4.10_A2_T18 #4'); - assert.throws(() => ''.match.call(Symbol(), /./), 'throws on symbol context'); + assert.throws(() => ''.match.call(Symbol('match test'), /./), 'throws on symbol context'); }; QUnit.test('String#match regression', run); diff --git a/tests/unit-global/es.string.pad-end.js b/tests/unit-global/es.string.pad-end.js index 6d4f2c61c19b..421aab6074fd 100644 --- a/tests/unit-global/es.string.pad-end.js +++ b/tests/unit-global/es.string.pad-end.js @@ -15,8 +15,9 @@ QUnit.test('String#padEnd', assert => { assert.same('foo'.padEnd(1), 'foo'); assert.same('foo'.padEnd(5, ''), 'foo'); - assert.throws(() => padEnd.call(Symbol(), 10, 'a'), 'throws on symbol context'); - assert.throws(() => padEnd.call('a', 10, Symbol()), 'throws on symbol argument'); + const symbol = Symbol('padEnd test'); + assert.throws(() => padEnd.call(symbol, 10, 'a'), 'throws on symbol context'); + assert.throws(() => padEnd.call('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padEnd.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.pad-start.js b/tests/unit-global/es.string.pad-start.js index f72d76733bd7..ff1b9a335f6c 100644 --- a/tests/unit-global/es.string.pad-start.js +++ b/tests/unit-global/es.string.pad-start.js @@ -15,8 +15,9 @@ QUnit.test('String#padStart', assert => { assert.same('foo'.padStart(1), 'foo'); assert.same('foo'.padStart(5, ''), 'foo'); - assert.throws(() => padStart.call(Symbol(), 10, 'a'), 'throws on symbol context'); - assert.throws(() => padStart.call('a', 10, Symbol()), 'throws on symbol argument'); + const symbol = Symbol('padStart test'); + assert.throws(() => padStart.call(symbol, 10, 'a'), 'throws on symbol context'); + assert.throws(() => padStart.call('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padStart.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.raw.js b/tests/unit-global/es.string.raw.js index c0c7be21cd71..a521b2297f98 100644 --- a/tests/unit-global/es.string.raw.js +++ b/tests/unit-global/es.string.raw.js @@ -11,8 +11,9 @@ QUnit.test('String.raw', assert => { assert.same(raw({ raw: [] }), '', 'empty template'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => raw({ raw: [Symbol()] }, 0), TypeError, 'throws on symbol #1'); - assert.throws(() => raw({ raw: 'test' }, Symbol()), TypeError, 'throws on symbol #2'); + const symbol = Symbol('raw test'); + assert.throws(() => raw({ raw: [symbol] }, 0), TypeError, 'throws on symbol #1'); + assert.throws(() => raw({ raw: 'test' }, symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => raw({}), TypeError); diff --git a/tests/unit-global/es.string.repeat.js b/tests/unit-global/es.string.repeat.js index 9a53947d645b..c62351695631 100644 --- a/tests/unit-global/es.string.repeat.js +++ b/tests/unit-global/es.string.repeat.js @@ -13,7 +13,7 @@ QUnit.test('String#repeat', assert => { assert.throws(() => 'qwe'.repeat(Infinity), RangeError); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => repeat.call(Symbol()), 'throws on symbol context'); + assert.throws(() => repeat.call(Symbol('repeat test')), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-global/es.string.replace-all.js b/tests/unit-global/es.string.replace-all.js index 86cf02f9176b..8b580ab57792 100644 --- a/tests/unit-global/es.string.replace-all.js +++ b/tests/unit-global/es.string.replace-all.js @@ -33,9 +33,10 @@ QUnit.test('String#replaceAll', assert => { assert.same('121314'.replaceAll('1', '$`'), '212312134', '$`'); assert.same('121314'.replaceAll('1', "$'"), '213142314344', "$'"); - assert.throws(() => replaceAll.call(Symbol(), 'a', 'b'), 'throws on symbol context'); - assert.throws(() => replaceAll.call('a', Symbol(), 'b'), 'throws on symbol argument 1'); - assert.throws(() => replaceAll.call('a', 'b', Symbol()), 'throws on symbol argument 2'); + const symbol = Symbol('replaceAll test'); + assert.throws(() => replaceAll.call(symbol, 'a', 'b'), 'throws on symbol context'); + assert.throws(() => replaceAll.call('a', symbol, 'b'), 'throws on symbol argument 1'); + assert.throws(() => replaceAll.call('a', 'b', symbol), 'throws on symbol argument 2'); if (STRICT) { assert.throws(() => replaceAll.call(null, 'a', 'b'), TypeError); diff --git a/tests/unit-global/es.string.replace.js b/tests/unit-global/es.string.replace.js index 33c1554ac3fc..0a5ecf2bde02 100644 --- a/tests/unit-global/es.string.replace.js +++ b/tests/unit-global/es.string.replace.js @@ -130,7 +130,7 @@ const run = assert => { // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing assert.same('a'.replace(/(.)/, '$0'), '$0'); - assert.throws(() => ''.replace.call(Symbol(), /./, ''), 'throws on symbol context'); + assert.throws(() => ''.replace.call(Symbol('replace test'), /./, ''), 'throws on symbol context'); }; QUnit.test('String#replace regression', run); diff --git a/tests/unit-global/es.string.search.js b/tests/unit-global/es.string.search.js index ae81ab8122f6..ee93770c8c62 100644 --- a/tests/unit-global/es.string.search.js +++ b/tests/unit-global/es.string.search.js @@ -73,7 +73,7 @@ const run = assert => { string = Object('power \u006F\u0066 the power of the power \u006F\u0066 the power of the power \u006F\u0066 the power of the great sword'); assert.same(string.search(/of/), string.search(/of/g), 'S15.5.4.12_A3_T2'); - assert.throws(() => ''.search.call(Symbol(), /./), 'throws on symbol context'); + assert.throws(() => ''.search.call(Symbol('search test'), /./), 'throws on symbol context'); }; QUnit.test('String#search regression', run); diff --git a/tests/unit-global/es.string.small.js b/tests/unit-global/es.string.small.js index 3a96cc2f94ea..d7fd26735a5f 100644 --- a/tests/unit-global/es.string.small.js +++ b/tests/unit-global/es.string.small.js @@ -8,6 +8,6 @@ QUnit.test('String#small', assert => { assert.same('a'.small(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => small.call(Symbol()), 'throws on symbol context'); + assert.throws(() => small.call(Symbol('small test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.split.js b/tests/unit-global/es.string.split.js index d71f85af4b19..e2d78aa75d61 100644 --- a/tests/unit-global/es.string.split.js +++ b/tests/unit-global/es.string.split.js @@ -689,7 +689,7 @@ const run = assert => { } } - assert.throws(() => ''.split.call(Symbol(), /./), 'throws on symbol context'); + assert.throws(() => ''.split.call(Symbol('aplit test'), /./), 'throws on symbol context'); }; QUnit.test('String#split regression', run); diff --git a/tests/unit-global/es.string.starts-with.js b/tests/unit-global/es.string.starts-with.js index 223e395eac07..a42c340f622d 100644 --- a/tests/unit-global/es.string.starts-with.js +++ b/tests/unit-global/es.string.starts-with.js @@ -23,8 +23,9 @@ QUnit.test('String#startsWith', assert => { assert.true('abc'.startsWith('a', 'x')); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => startsWith.call(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => startsWith.call('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('startsWith test'); + assert.throws(() => startsWith.call(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => startsWith.call('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-global/es.string.strike.js b/tests/unit-global/es.string.strike.js index b7e549132b4a..b4b39441787a 100644 --- a/tests/unit-global/es.string.strike.js +++ b/tests/unit-global/es.string.strike.js @@ -8,6 +8,6 @@ QUnit.test('String#strike', assert => { assert.same('a'.strike(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => strike.call(Symbol()), 'throws on symbol context'); + assert.throws(() => strike.call(Symbol('strike test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.sub.js b/tests/unit-global/es.string.sub.js index 5709764803b2..8bc2e3de1c0d 100644 --- a/tests/unit-global/es.string.sub.js +++ b/tests/unit-global/es.string.sub.js @@ -8,6 +8,6 @@ QUnit.test('String#sub', assert => { assert.same('a'.sub(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => sub.call(Symbol()), 'throws on symbol context'); + assert.throws(() => sub.call(Symbol('sub test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.substr.js b/tests/unit-global/es.string.substr.js index 7b2b224e05e0..3d7482127978 100644 --- a/tests/unit-global/es.string.substr.js +++ b/tests/unit-global/es.string.substr.js @@ -13,7 +13,7 @@ QUnit.test('String#substr', assert => { assert.same('ab'.substr(-1), 'b'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => substr.call(Symbol(), 1, 3), 'throws on symbol context'); + assert.throws(() => substr.call(Symbol('substr test'), 1, 3), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-global/es.string.sup.js b/tests/unit-global/es.string.sup.js index 477791edf2b9..36465bac7162 100644 --- a/tests/unit-global/es.string.sup.js +++ b/tests/unit-global/es.string.sup.js @@ -8,6 +8,6 @@ QUnit.test('String#sup', assert => { assert.same('a'.sup(), 'a', 'lower case'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => sup.call(Symbol()), 'throws on symbol context'); + assert.throws(() => sup.call(Symbol('sup test')), 'throws on symbol context'); } }); diff --git a/tests/unit-global/es.string.to-well-formed.js b/tests/unit-global/es.string.to-well-formed.js index a8b40006dede..819d9c003264 100644 --- a/tests/unit-global/es.string.to-well-formed.js +++ b/tests/unit-global/es.string.to-well-formed.js @@ -36,5 +36,5 @@ QUnit.test('String#toWellFormed', assert => { assert.throws(() => toWellFormed.call(undefined), TypeError, 'coercible #2'); } - assert.throws(() => toWellFormed.call(Symbol()), 'throws on symbol context'); + assert.throws(() => toWellFormed.call(Symbol('toWellFormed test')), 'throws on symbol context'); }); diff --git a/tests/unit-global/es.string.trim-end.js b/tests/unit-global/es.string.trim-end.js index e35090e5a6b1..716795e1649a 100644 --- a/tests/unit-global/es.string.trim-end.js +++ b/tests/unit-global/es.string.trim-end.js @@ -12,7 +12,7 @@ QUnit.test('String#trimEnd', assert => { assert.same(WHITESPACES.trimEnd(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimEnd(), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimEnd.call(Symbol()), 'throws on symbol context'); + assert.throws(() => trimEnd.call(Symbol('trimEnd test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimEnd.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.trim-left.js b/tests/unit-global/es.string.trim-left.js index cd13a2543063..307529f85dd2 100644 --- a/tests/unit-global/es.string.trim-left.js +++ b/tests/unit-global/es.string.trim-left.js @@ -11,7 +11,7 @@ QUnit.test('String#trimLeft', assert => { assert.same(WHITESPACES.trimLeft(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimLeft(), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimLeft.call(Symbol()), 'throws on symbol context'); + assert.throws(() => trimLeft.call(Symbol('trimLeft test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimLeft.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.trim-right.js b/tests/unit-global/es.string.trim-right.js index 019d8e864cd9..93e9b253dbb9 100644 --- a/tests/unit-global/es.string.trim-right.js +++ b/tests/unit-global/es.string.trim-right.js @@ -11,7 +11,7 @@ QUnit.test('String#trimRight', assert => { assert.same(WHITESPACES.trimRight(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimRight(), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimRight.call(Symbol()), 'throws on symbol context'); + assert.throws(() => trimRight.call(Symbol('trimRight test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimRight.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.trim-start.js b/tests/unit-global/es.string.trim-start.js index f8d4f051feff..e55eb993d9c3 100644 --- a/tests/unit-global/es.string.trim-start.js +++ b/tests/unit-global/es.string.trim-start.js @@ -12,7 +12,7 @@ QUnit.test('String#trimStart', assert => { assert.same(WHITESPACES.trimStart(), '', 'removes all whitespaces'); assert.same('\u200B\u0085'.trimStart(), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimStart.call(Symbol()), 'throws on symbol context'); + assert.throws(() => trimStart.call(Symbol('trimStart test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimStart.call(null, 0), TypeError); diff --git a/tests/unit-global/es.string.trim.js b/tests/unit-global/es.string.trim.js index 609e80d6653a..5bc6ebaec5c3 100644 --- a/tests/unit-global/es.string.trim.js +++ b/tests/unit-global/es.string.trim.js @@ -12,7 +12,7 @@ QUnit.test('String#trim', assert => { assert.same('\u200B\u0085'.trim(), '\u200B\u0085', "shouldn't remove this symbols"); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => trim.call(Symbol()), 'throws on symbol context'); + assert.throws(() => trim.call(Symbol('trim test')), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-global/es.symbol.constructor.js b/tests/unit-global/es.symbol.constructor.js index 5aca8b76919b..b4ef501e5ba8 100644 --- a/tests/unit-global/es.symbol.constructor.js +++ b/tests/unit-global/es.symbol.constructor.js @@ -60,7 +60,7 @@ QUnit.test('Well-known Symbols', assert => { }); QUnit.test('Symbol#@@toPrimitive', assert => { - const symbol = Symbol(); + const symbol = Symbol('Symbol#@@toPrimitive test'); assert.isFunction(Symbol.prototype[Symbol.toPrimitive]); assert.same(symbol, symbol[Symbol.toPrimitive](), 'works'); }); @@ -234,6 +234,6 @@ if (DESCRIPTORS) { }); QUnit.test('Symbol.sham flag', assert => { - assert.same(Symbol.sham, typeof Symbol() == 'symbol' ? undefined : true); + assert.same(Symbol.sham, typeof Symbol('Symbol.sham flag test') == 'symbol' ? undefined : true); }); } diff --git a/tests/unit-global/es.symbol.description.js b/tests/unit-global/es.symbol.description.js index e63c5fc0f10a..54095ea2e16b 100644 --- a/tests/unit-global/es.symbol.description.js +++ b/tests/unit-global/es.symbol.description.js @@ -1,3 +1,4 @@ +/* eslint-disable symbol-description -- required for testing */ import { DESCRIPTORS } from '../helpers/constants'; QUnit.test('Symbol#description', assert => { diff --git a/tests/unit-global/es.unescape.js b/tests/unit-global/es.unescape.js index 33b1a0619d05..81db1e709173 100644 --- a/tests/unit-global/es.unescape.js +++ b/tests/unit-global/es.unescape.js @@ -9,6 +9,6 @@ QUnit.test('unescape', assert => { assert.same(unescape(undefined), 'undefined'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => unescape(Symbol()), 'throws on symbol argument'); + assert.throws(() => unescape(Symbol('unescape test')), 'throws on symbol argument'); } }); diff --git a/tests/unit-global/esnext.json.is-raw-json.js b/tests/unit-global/esnext.json.is-raw-json.js index 2cede53fff6a..13a6cf722e18 100644 --- a/tests/unit-global/esnext.json.is-raw-json.js +++ b/tests/unit-global/esnext.json.is-raw-json.js @@ -15,7 +15,7 @@ QUnit.test('JSON.rawJSON', assert => { assert.false(isRawJSON(1), 'number'); assert.false(isRawJSON('qwe'), 'string'); assert.false(isRawJSON(true), 'bool'); - assert.false(isRawJSON(Symbol()), 'sym'); + assert.false(isRawJSON(Symbol('JSON.isRawJSON test')), 'sym'); assert.false(isRawJSON({}), 'object'); assert.false(isRawJSON([]), 'array'); }); diff --git a/tests/unit-global/esnext.json.parse.js b/tests/unit-global/esnext.json.parse.js index 5741acfa70b5..b1ff3a17579f 100644 --- a/tests/unit-global/esnext.json.parse.js +++ b/tests/unit-global/esnext.json.parse.js @@ -127,7 +127,7 @@ QUnit.test('JSON.parse', assert => { assert.same(parse(-0, reviver), 0, `negative-zero-5 ${ note }`); assert.throws(() => parse(undefined, reviver), SyntaxError, `undefined ${ note }`); - assert.throws(() => parse(Symbol(), reviver), TypeError, `symbol ${ note }`); + assert.throws(() => parse(Symbol('JSON.parse test'), reviver), TypeError, `symbol ${ note }`); assert.same(parse(null, reviver), null, `null ${ note }`); assert.same(parse(false, reviver), false, `false ${ note }`); assert.same(parse(true, reviver), true, `true ${ note }`); diff --git a/tests/unit-global/esnext.string.cooked.js b/tests/unit-global/esnext.string.cooked.js index 11668f290e6c..da4d4a838075 100644 --- a/tests/unit-global/esnext.string.cooked.js +++ b/tests/unit-global/esnext.string.cooked.js @@ -11,8 +11,9 @@ QUnit.test('String.cooked', assert => { assert.same(cooked([]), '', 'empty template'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => cooked([Symbol()]), TypeError, 'throws on symbol #1'); - assert.throws(() => cooked('test', Symbol()), TypeError, 'throws on symbol #2'); + const symbol = Symbol('cooked test'); + assert.throws(() => cooked([symbol]), TypeError, 'throws on symbol #1'); + assert.throws(() => cooked('test', symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => cooked([undefined]), TypeError); diff --git a/tests/unit-global/esnext.string.dedent.js b/tests/unit-global/esnext.string.dedent.js index b6d5d543e27d..508578e7954c 100644 --- a/tests/unit-global/esnext.string.dedent.js +++ b/tests/unit-global/esnext.string.dedent.js @@ -42,7 +42,7 @@ QUnit.test('String.dedent', assert => { assert.same(dedent(tag), dedent(tag), '#7'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => dedent({ raw: freeze(['\n', Symbol(), '\n']) }), TypeError, 'throws on symbol'); + assert.throws(() => dedent({ raw: freeze(['\n', Symbol('dedent test'), '\n']) }), TypeError, 'throws on symbol'); } assert.throws(() => dedent([]), TypeError, '[]'); diff --git a/tests/unit-global/esnext.suppressed-error.constructor.js b/tests/unit-global/esnext.suppressed-error.constructor.js index 1424b9327b41..e52f58f6094f 100644 --- a/tests/unit-global/esnext.suppressed-error.constructor.js +++ b/tests/unit-global/esnext.suppressed-error.constructor.js @@ -40,7 +40,7 @@ QUnit.test('SuppressedError', assert => { assert.false('cause' in error2); assert.same(error2.name, 'SuppressedError'); - assert.throws(() => SuppressedError(1, 2, Symbol()), 'throws on symbol as a message'); + assert.throws(() => SuppressedError(1, 2, Symbol('SuppressedError constructor test')), 'throws on symbol as a message'); assert.same(({}).toString.call(SuppressedError()), '[object Error]', 'Object#toString'); assert.same(SuppressedError.prototype.constructor, SuppressedError, 'prototype constructor'); diff --git a/tests/unit-global/esnext.symbol.is-registered-symbol.js b/tests/unit-global/esnext.symbol.is-registered-symbol.js index 787e656d7db2..b80118fa1390 100644 --- a/tests/unit-global/esnext.symbol.is-registered-symbol.js +++ b/tests/unit-global/esnext.symbol.is-registered-symbol.js @@ -6,10 +6,11 @@ QUnit.test('Symbol.isRegisteredSymbol', assert => { assert.name(isRegisteredSymbol, 'isRegisteredSymbol', 'Symbol.isRegisteredSymbol.name is "isRegisteredSymbol"'); assert.looksNative(isRegisteredSymbol, 'isRegisteredSymbol looks like native'); - assert.true(isRegisteredSymbol(Symbol.for('foo')), 'registered-1'); - assert.true(isRegisteredSymbol(Object(Symbol.for('foo'))), 'registered-2'); - assert.false(isRegisteredSymbol(Symbol()), 'non-registered'); - assert.false(isRegisteredSymbol(Object(Symbol())), 'non-registered'); + assert.true(isRegisteredSymbol(Symbol.for('foo')), 'registered'); + assert.true(isRegisteredSymbol(Object(Symbol.for('foo'))), 'registered, boxed'); + const symbol = Symbol('Symbol.isRegisteredSymbol test'); + assert.false(isRegisteredSymbol(symbol), 'non-registered'); + assert.false(isRegisteredSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isRegisteredSymbol(1), '1'); assert.false(isRegisteredSymbol(true), 'true'); assert.false(isRegisteredSymbol('1'), 'string'); diff --git a/tests/unit-global/esnext.symbol.is-registered.js b/tests/unit-global/esnext.symbol.is-registered.js index 6e3395011669..c168eb5b2de9 100644 --- a/tests/unit-global/esnext.symbol.is-registered.js +++ b/tests/unit-global/esnext.symbol.is-registered.js @@ -6,10 +6,11 @@ QUnit.test('Symbol.isRegistered', assert => { assert.name(isRegistered, 'isRegisteredSymbol', 'Symbol.isRegistered.name is "isRegisteredSymbol"'); assert.looksNative(isRegistered, 'isRegistered looks like native'); - assert.true(isRegistered(Symbol.for('foo')), 'registered-1'); - assert.true(isRegistered(Object(Symbol.for('foo'))), 'registered-2'); - assert.false(isRegistered(Symbol()), 'non-registered'); - assert.false(isRegistered(Object(Symbol())), 'non-registered'); + assert.true(isRegistered(Symbol.for('foo')), 'registered'); + assert.true(isRegistered(Object(Symbol.for('foo'))), 'registered, boxed'); + const symbol = Symbol('Symbol.isRegistered test'); + assert.false(isRegistered(symbol), 'non-registered'); + assert.false(isRegistered(Object(symbol)), 'non-registered, boxed'); assert.false(isRegistered(1), '1'); assert.false(isRegistered(true), 'true'); assert.false(isRegistered('1'), 'string'); diff --git a/tests/unit-global/esnext.symbol.is-well-known-symbol.js b/tests/unit-global/esnext.symbol.is-well-known-symbol.js index 41f8e4910db4..f1b1dad8f8d8 100644 --- a/tests/unit-global/esnext.symbol.is-well-known-symbol.js +++ b/tests/unit-global/esnext.symbol.is-well-known-symbol.js @@ -7,11 +7,12 @@ QUnit.test('Symbol.isWellKnownSymbol', assert => { assert.looksNative(isWellKnownSymbol, 'isWellKnownSymbol looks like native'); assert.true(isWellKnownSymbol(Symbol.iterator), 'registered-1'); - assert.true(isWellKnownSymbol(Object(Symbol.iterator)), 'registered-2'); + assert.true(isWellKnownSymbol(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnownSymbol(Symbol.patternMatch), 'registered-3'); - assert.true(isWellKnownSymbol(Object(Symbol.patternMatch)), 'registered-4'); - assert.false(isWellKnownSymbol(Symbol()), 'non-registered'); - assert.false(isWellKnownSymbol(Object(Symbol())), 'non-registered'); + assert.true(isWellKnownSymbol(Object(Symbol.patternMatch)), 'registered-4, boxed'); + const symbol = Symbol('Symbol.isWellKnownSymbol test'); + assert.false(isWellKnownSymbol(symbol), 'non-registered'); + assert.false(isWellKnownSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnownSymbol(1), '1'); assert.false(isWellKnownSymbol(true), 'true'); assert.false(isWellKnownSymbol('1'), 'string'); diff --git a/tests/unit-global/esnext.symbol.is-well-known.js b/tests/unit-global/esnext.symbol.is-well-known.js index 5c3224fcff7e..a7188a1dae41 100644 --- a/tests/unit-global/esnext.symbol.is-well-known.js +++ b/tests/unit-global/esnext.symbol.is-well-known.js @@ -7,11 +7,12 @@ QUnit.test('Symbol.isWellKnown', assert => { assert.looksNative(isWellKnown, 'isWellKnown looks like native'); assert.true(isWellKnown(Symbol.iterator), 'registered-1'); - assert.true(isWellKnown(Object(Symbol.iterator)), 'registered-2'); + assert.true(isWellKnown(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnown(Symbol.patternMatch), 'registered-3'); - assert.true(isWellKnown(Object(Symbol.patternMatch)), 'registered-4'); - assert.false(isWellKnown(Symbol()), 'non-registered'); - assert.false(isWellKnown(Object(Symbol())), 'non-registered'); + assert.true(isWellKnown(Object(Symbol.patternMatch)), 'registered-4, boxed'); + const symbol = Symbol('Symbol.isWellKnown test'); + assert.false(isWellKnown(symbol), 'non-registered'); + assert.false(isWellKnown(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnown(1), '1'); assert.false(isWellKnown(true), 'true'); assert.false(isWellKnown('1'), 'string'); diff --git a/tests/unit-global/web.dom-exception.constructor.js b/tests/unit-global/web.dom-exception.constructor.js index 92fa24c24b13..1cff6753e6dc 100644 --- a/tests/unit-global/web.dom-exception.constructor.js +++ b/tests/unit-global/web.dom-exception.constructor.js @@ -67,8 +67,9 @@ QUnit.test('DOMException', assert => { } assert.throws(() => DOMException(42, 'DataCloneError'), "DOMException(42, 'DataCloneError')"); - assert.throws(() => new DOMException(Symbol(), 'DataCloneError'), "new DOMException(Symbol(), 'DataCloneError')"); - assert.throws(() => new DOMException(42, Symbol()), 'new DOMException(42, Symbol())'); + const symbol = Symbol('DOMException constructor test'); + assert.throws(() => new DOMException(symbol, 'DataCloneError'), "new DOMException(Symbol(), 'DataCloneError')"); + assert.throws(() => new DOMException(42, symbol), 'new DOMException(42, Symbol())'); if (DESCRIPTORS) { // assert.throws(() => DOMException.prototype.message, 'DOMException.prototype.message'); // FF55- , Safari 10.1 bug // assert.throws(() => DOMException.prototype.name, 'DOMException.prototype.name'); // FF55-, Safari 10.1 bug bug diff --git a/tests/unit-pure/es.escape.js b/tests/unit-pure/es.escape.js index d984dd6c95b6..1f97d92054d0 100644 --- a/tests/unit-pure/es.escape.js +++ b/tests/unit-pure/es.escape.js @@ -9,6 +9,6 @@ QUnit.test('escape', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => escape(Symbol()), 'throws on symbol argument'); + assert.throws(() => escape(Symbol('escape test')), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/es.json.stringify.js b/tests/unit-pure/es.json.stringify.js index 04ed685bf640..d51426c7d3e5 100644 --- a/tests/unit-pure/es.json.stringify.js +++ b/tests/unit-pure/es.json.stringify.js @@ -143,7 +143,7 @@ if (GLOBAL.JSON?.stringify) { assert.same(stringify(obj4, null), json1, 'replacer-wrong-type-4'); assert.same(stringify(obj4, ''), json1, 'replacer-wrong-type-5'); assert.same(stringify(obj4, 0), json1, 'replacer-wrong-type-6'); - assert.same(stringify(obj4, Symbol()), json1, 'replacer-wrong-type-7'); + assert.same(stringify(obj4, Symbol('stringify replacer test')), json1, 'replacer-wrong-type-7'); assert.same(stringify(obj4, true), json1, 'replacer-wrong-type-8'); const obj5 = { @@ -209,7 +209,7 @@ if (GLOBAL.JSON?.stringify) { assert.same(stringify(obj5), stringify(obj5, null, null), 'space-wrong-type-1'); assert.same(stringify(obj5), stringify(obj5, null, true), 'space-wrong-type-2'); assert.same(stringify(obj5), stringify(obj5, null, new Boolean(false)), 'space-wrong-type-3'); - assert.same(stringify(obj5), stringify(obj5, null, Symbol()), 'space-wrong-type-4'); + assert.same(stringify(obj5), stringify(obj5, null, Symbol('stringify space test')), 'space-wrong-type-4'); assert.same(stringify(obj5), stringify(obj5, null, {}), 'space-wrong-type-5'); const direct2 = []; @@ -485,24 +485,27 @@ if (GLOBAL.JSON?.stringify) { }); QUnit.test('Symbols & JSON.stringify', assert => { + const symbol1 = Symbol('symbol & stringify test 1'); + const symbol2 = Symbol('symbol & stringify test 2'); + assert.same(stringify([ 1, - Symbol('foo'), + symbol1, false, - Symbol('bar'), + symbol2, {}, ]), '[1,null,false,null,{}]', 'array value'); assert.same(stringify({ - symbol: Symbol('symbol'), + symbol: symbol1, }), '{}', 'object value'); if (DESCRIPTORS) { const object = { bar: 2 }; - object[Symbol('symbol')] = 1; + object[symbol1] = 1; assert.same(stringify(object), '{"bar":2}', 'object key'); } - assert.same(stringify(Symbol('symbol')), undefined, 'symbol value'); - if (typeof Symbol() == 'symbol') { - assert.same(stringify(Object(Symbol('symbol'))), '{}', 'boxed symbol'); + assert.same(stringify(symbol1), undefined, 'symbol value'); + if (typeof symbol1 == 'symbol') { + assert.same(stringify(Object(symbol1)), '{}', 'boxed symbol'); } assert.same(stringify(undefined, () => 42), '42', 'replacer works with top-level undefined'); }); diff --git a/tests/unit-pure/es.number.constructor.js b/tests/unit-pure/es.number.constructor.js index 7520c26c65e8..93a7b15fbcd4 100644 --- a/tests/unit-pure/es.number.constructor.js +++ b/tests/unit-pure/es.number.constructor.js @@ -163,8 +163,9 @@ QUnit.test('Number constructor: regression', assert => { }), TypeError, 'new Number assert.throws on object then valueOf and toString are not functions'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => Number(Symbol()), 'throws on symbol argument'); - assert.throws(() => new Number(Symbol()), 'throws on symbol argument, new'); + const symbol = Symbol('Number constructor test'); + assert.throws(() => Number(symbol), 'throws on symbol argument'); + assert.throws(() => new Number(symbol), 'throws on symbol argument, new'); } number = new Number(42); diff --git a/tests/unit-pure/es.number.parse-float.js b/tests/unit-pure/es.number.parse-float.js index 484060523cf8..efc267537905 100644 --- a/tests/unit-pure/es.number.parse-float.js +++ b/tests/unit-pure/es.number.parse-float.js @@ -18,7 +18,8 @@ QUnit.test('Number.parseFloat', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => parseFloat(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseFloat(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('Number.parseFloat test'); + assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); + assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-pure/es.number.parse-int.js b/tests/unit-pure/es.number.parse-int.js index b87c272ad6dc..30d78c42cb79 100644 --- a/tests/unit-pure/es.number.parse-int.js +++ b/tests/unit-pure/es.number.parse-int.js @@ -36,7 +36,8 @@ QUnit.test('Number.parseInt', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => parseInt(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseInt(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('Number.parseInt test'); + assert.throws(() => parseInt(symbol), 'throws on symbol argument'); + assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-pure/es.object.get-own-property-symbols.js b/tests/unit-pure/es.object.get-own-property-symbols.js index 7cc2d118b53b..8dd757dbd116 100644 --- a/tests/unit-pure/es.object.get-own-property-symbols.js +++ b/tests/unit-pure/es.object.get-own-property-symbols.js @@ -6,15 +6,15 @@ import Symbol from 'core-js-pure/es/symbol'; QUnit.test('Object.getOwnPropertySymbols', assert => { assert.isFunction(getOwnPropertySymbols); const prototype = { q: 1, w: 2, e: 3 }; - prototype[Symbol()] = 42; - prototype[Symbol()] = 43; + prototype[Symbol('getOwnPropertySymbols test 1')] = 42; + prototype[Symbol('getOwnPropertySymbols test 2')] = 43; assert.deepEqual(getOwnPropertyNames(prototype).sort(), ['e', 'q', 'w']); assert.same(getOwnPropertySymbols(prototype).length, 2); const object = create(prototype); object.a = 1; object.s = 2; object.d = 3; - object[Symbol()] = 44; + object[Symbol('getOwnPropertySymbols test 3')] = 44; assert.deepEqual(getOwnPropertyNames(object).sort(), ['a', 'd', 's']); assert.same(getOwnPropertySymbols(object).length, 1); assert.same(getOwnPropertySymbols(Object.prototype).length, 0); diff --git a/tests/unit-pure/es.parse-float.js b/tests/unit-pure/es.parse-float.js index e5acc4b569b0..2ab4daae667c 100644 --- a/tests/unit-pure/es.parse-float.js +++ b/tests/unit-pure/es.parse-float.js @@ -17,7 +17,8 @@ QUnit.test('parseFloat', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => parseFloat(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseFloat(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('parseFloat test'); + assert.throws(() => parseFloat(symbol), 'throws on symbol argument'); + assert.throws(() => parseFloat(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-pure/es.parse-int.js b/tests/unit-pure/es.parse-int.js index a7afaed795f0..5e24576c30ff 100644 --- a/tests/unit-pure/es.parse-int.js +++ b/tests/unit-pure/es.parse-int.js @@ -35,7 +35,8 @@ QUnit.test('parseInt', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => parseInt(Symbol()), 'throws on symbol argument'); - assert.throws(() => parseInt(Object(Symbol())), 'throws on boxed symbol argument'); + const symbol = Symbol('parseInt test'); + assert.throws(() => parseInt(symbol), 'throws on symbol argument'); + assert.throws(() => parseInt(Object(symbol)), 'throws on boxed symbol argument'); } }); diff --git a/tests/unit-pure/es.string.anchor.js b/tests/unit-pure/es.string.anchor.js index b4a466a24786..010d02ed4852 100644 --- a/tests/unit-pure/es.string.anchor.js +++ b/tests/unit-pure/es.string.anchor.js @@ -7,7 +7,8 @@ QUnit.test('String#anchor', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => anchor(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => anchor('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('anchor test'); + assert.throws(() => anchor(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => anchor('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/es.string.at-alternative.js b/tests/unit-pure/es.string.at-alternative.js index 459c0bc549d7..5865cca1d78c 100644 --- a/tests/unit-pure/es.string.at-alternative.js +++ b/tests/unit-pure/es.string.at-alternative.js @@ -23,7 +23,7 @@ QUnit.test('String#at', assert => { // assert.same('\uD842', at('𠮷')); assert.same('1', at({ toString() { return '123'; } }, 0)); - assert.throws(() => at(Symbol(), 0), 'throws on symbol context'); + assert.throws(() => at(Symbol('at-alternative test'), 0), 'throws on symbol context'); if (STRICT) { assert.throws(() => at(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.big.js b/tests/unit-pure/es.string.big.js index bdb794badb02..4230806eceaa 100644 --- a/tests/unit-pure/es.string.big.js +++ b/tests/unit-pure/es.string.big.js @@ -6,6 +6,6 @@ QUnit.test('String#big', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => big(Symbol()), 'throws on symbol argument'); + assert.throws(() => big(Symbol('big test')), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/es.string.blink.js b/tests/unit-pure/es.string.blink.js index b3fe96378437..9f6cd00a6b90 100644 --- a/tests/unit-pure/es.string.blink.js +++ b/tests/unit-pure/es.string.blink.js @@ -6,6 +6,6 @@ QUnit.test('String#blink', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => blink(Symbol()), 'throws on symbol context'); + assert.throws(() => blink(Symbol('blink test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.bold.js b/tests/unit-pure/es.string.bold.js index a0d938b0d67d..582210eabda7 100644 --- a/tests/unit-pure/es.string.bold.js +++ b/tests/unit-pure/es.string.bold.js @@ -6,6 +6,6 @@ QUnit.test('String#bold', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => bold(Symbol()), 'throws on symbol context'); + assert.throws(() => bold(Symbol('bold test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.code-point-at.js b/tests/unit-pure/es.string.code-point-at.js index 72d4295c7efc..b8a20774c4f5 100644 --- a/tests/unit-pure/es.string.code-point-at.js +++ b/tests/unit-pure/es.string.code-point-at.js @@ -56,7 +56,7 @@ QUnit.test('String#codePointAt', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => codePointAt(Symbol(), 1), 'throws on symbol context'); + assert.throws(() => codePointAt(Symbol('codePointAt test'), 1), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-pure/es.string.ends-with.js b/tests/unit-pure/es.string.ends-with.js index ba5e8b922b62..c161204ab388 100644 --- a/tests/unit-pure/es.string.ends-with.js +++ b/tests/unit-pure/es.string.ends-with.js @@ -20,8 +20,9 @@ QUnit.test('String#endsWith', assert => { assert.false(endsWith('abc', 'a', 'x')); if (!Symbol.sham) { - assert.throws(() => endsWith(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => endsWith('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('endsWith test'); + assert.throws(() => endsWith(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => endsWith('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-pure/es.string.fixed.js b/tests/unit-pure/es.string.fixed.js index 1851da4c834b..18136900bbd7 100644 --- a/tests/unit-pure/es.string.fixed.js +++ b/tests/unit-pure/es.string.fixed.js @@ -6,6 +6,6 @@ QUnit.test('String#fixed', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => fixed(Symbol()), 'throws on symbol context'); + assert.throws(() => fixed(Symbol('fixed test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.fontcolor.js b/tests/unit-pure/es.string.fontcolor.js index 9a037f291cc9..5a33d7f6726d 100644 --- a/tests/unit-pure/es.string.fontcolor.js +++ b/tests/unit-pure/es.string.fontcolor.js @@ -7,7 +7,8 @@ QUnit.test('String#fontcolor', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => fontcolor(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => fontcolor('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('fontcolor test'); + assert.throws(() => fontcolor(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => fontcolor('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/es.string.fontsize.js b/tests/unit-pure/es.string.fontsize.js index 524b59fe9954..e2716d70ea00 100644 --- a/tests/unit-pure/es.string.fontsize.js +++ b/tests/unit-pure/es.string.fontsize.js @@ -7,7 +7,8 @@ QUnit.test('String#fontsize', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => fontsize(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => fontsize('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('fontsize test'); + assert.throws(() => fontsize(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => fontsize('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/es.string.includes.js b/tests/unit-pure/es.string.includes.js index 29508f957a66..4cd7d4474b03 100644 --- a/tests/unit-pure/es.string.includes.js +++ b/tests/unit-pure/es.string.includes.js @@ -11,8 +11,9 @@ QUnit.test('String#includes', assert => { assert.false(includes('abcd', 'b', 2)); if (!Symbol.sham) { - assert.throws(() => includes(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => includes('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('includes test'); + assert.throws(() => includes(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => includes('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-pure/es.string.is-well-formed.js b/tests/unit-pure/es.string.is-well-formed.js index 2429a8c3a327..d39bbaf15b2b 100644 --- a/tests/unit-pure/es.string.is-well-formed.js +++ b/tests/unit-pure/es.string.is-well-formed.js @@ -37,5 +37,5 @@ QUnit.test('String#isWellFormed', assert => { assert.throws(() => isWellFormed.call(undefined), TypeError, 'coercible #2'); } - assert.throws(() => isWellFormed.call(Symbol()), 'throws on symbol context'); + assert.throws(() => isWellFormed.call(Symbol('isWellFormed test')), 'throws on symbol context'); }); diff --git a/tests/unit-pure/es.string.italics.js b/tests/unit-pure/es.string.italics.js index 2682922f5cd5..de2efc99e726 100644 --- a/tests/unit-pure/es.string.italics.js +++ b/tests/unit-pure/es.string.italics.js @@ -6,6 +6,6 @@ QUnit.test('String#italics', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => italics(Symbol()), 'throws on symbol context'); + assert.throws(() => italics(Symbol('italics test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.link.js b/tests/unit-pure/es.string.link.js index 87267efe1dcd..58a353777882 100644 --- a/tests/unit-pure/es.string.link.js +++ b/tests/unit-pure/es.string.link.js @@ -7,7 +7,8 @@ QUnit.test('String#link', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => link(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => link('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('link test'); + assert.throws(() => link(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => link('a', symbol), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/es.string.match-all.js b/tests/unit-pure/es.string.match-all.js index c5e42e7317f4..1fc2a96434b2 100644 --- a/tests/unit-pure/es.string.match-all.js +++ b/tests/unit-pure/es.string.match-all.js @@ -126,7 +126,7 @@ QUnit.test('String#matchAll', assert => { assert.notThrows(() => matchAll('', target), `Not throws on ${ target } as the first argument`); } - assert.throws(() => matchAll(Symbol(), /./), 'throws on symbol context'); + assert.throws(() => matchAll(Symbol('matchAll test'), /./), 'throws on symbol context'); if (STRICT) { assert.throws(() => matchAll(null, /./g), TypeError, 'Throws on null as `this`'); diff --git a/tests/unit-pure/es.string.pad-end.js b/tests/unit-pure/es.string.pad-end.js index 7f49e5326530..4c9399eb9eda 100644 --- a/tests/unit-pure/es.string.pad-end.js +++ b/tests/unit-pure/es.string.pad-end.js @@ -13,8 +13,9 @@ QUnit.test('String#padEnd', assert => { assert.same(padEnd('foo', 1), 'foo'); assert.same(padEnd('foo', 5, ''), 'foo'); - assert.throws(() => padEnd(Symbol(), 10, 'a'), 'throws on symbol context'); - assert.throws(() => padEnd('a', 10, Symbol()), 'throws on symbol argument'); + const symbol = Symbol('padEnd test'); + assert.throws(() => padEnd(symbol, 10, 'a'), 'throws on symbol context'); + assert.throws(() => padEnd('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padEnd(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.pad-start.js b/tests/unit-pure/es.string.pad-start.js index 589d86191507..3a8c9120e763 100644 --- a/tests/unit-pure/es.string.pad-start.js +++ b/tests/unit-pure/es.string.pad-start.js @@ -13,8 +13,9 @@ QUnit.test('String#padStart', assert => { assert.same(padStart('foo', 1), 'foo'); assert.same(padStart('foo', 5, ''), 'foo'); - assert.throws(() => padStart(Symbol(), 10, 'a'), 'throws on symbol context'); - assert.throws(() => padStart('a', 10, Symbol()), 'throws on symbol argument'); + const symbol = Symbol('padEnd test'); + assert.throws(() => padStart(symbol, 10, 'a'), 'throws on symbol context'); + assert.throws(() => padStart('a', 10, symbol), 'throws on symbol argument'); if (STRICT) { assert.throws(() => padStart(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.raw.js b/tests/unit-pure/es.string.raw.js index 1c631384e55b..181c75e0a3d3 100644 --- a/tests/unit-pure/es.string.raw.js +++ b/tests/unit-pure/es.string.raw.js @@ -13,8 +13,9 @@ QUnit.test('String.raw', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => raw({ raw: [Symbol()] }, 0), TypeError, 'throws on symbol #1'); - assert.throws(() => raw({ raw: 'test' }, Symbol()), TypeError, 'throws on symbol #2'); + const symbol = Symbol('raw test'); + assert.throws(() => raw({ raw: [symbol] }, 0), TypeError, 'throws on symbol #1'); + assert.throws(() => raw({ raw: 'test' }, symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => raw({}), TypeError); diff --git a/tests/unit-pure/es.string.repeat.js b/tests/unit-pure/es.string.repeat.js index d7a61d66a1a3..7ad58037486e 100644 --- a/tests/unit-pure/es.string.repeat.js +++ b/tests/unit-pure/es.string.repeat.js @@ -11,7 +11,7 @@ QUnit.test('String#repeat', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => repeat(Symbol()), 'throws on symbol context'); + assert.throws(() => repeat(Symbol('repeat test')), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-pure/es.string.replace-all.js b/tests/unit-pure/es.string.replace-all.js index 9eca17623850..81a7611a9fca 100644 --- a/tests/unit-pure/es.string.replace-all.js +++ b/tests/unit-pure/es.string.replace-all.js @@ -31,9 +31,10 @@ QUnit.test('String#replaceAll', assert => { assert.same(replaceAll('121314', '1', '$`'), '212312134', '$`'); assert.same(replaceAll('121314', '1', "$'"), '213142314344', "$'"); - assert.throws(() => replaceAll(Symbol(), 'a', 'b'), 'throws on symbol context'); - assert.throws(() => replaceAll('a', Symbol(), 'b'), 'throws on symbol argument 1'); - assert.throws(() => replaceAll('a', 'b', Symbol()), 'throws on symbol argument 2'); + const symbol = Symbol('replaceAll test'); + assert.throws(() => replaceAll(symbol, 'a', 'b'), 'throws on symbol context'); + assert.throws(() => replaceAll('a', symbol, 'b'), 'throws on symbol argument 1'); + assert.throws(() => replaceAll('a', 'b', symbol), 'throws on symbol argument 2'); if (STRICT) { assert.throws(() => replaceAll(null, 'a', 'b'), TypeError); diff --git a/tests/unit-pure/es.string.small.js b/tests/unit-pure/es.string.small.js index c2302824f859..a4326d3b281e 100644 --- a/tests/unit-pure/es.string.small.js +++ b/tests/unit-pure/es.string.small.js @@ -6,6 +6,6 @@ QUnit.test('String#small', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => small(Symbol()), 'throws on symbol context'); + assert.throws(() => small(Symbol('small test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.starts-with.js b/tests/unit-pure/es.string.starts-with.js index 7461685444ce..08a7eaf705a5 100644 --- a/tests/unit-pure/es.string.starts-with.js +++ b/tests/unit-pure/es.string.starts-with.js @@ -19,8 +19,9 @@ QUnit.test('String#startsWith', assert => { assert.true(startsWith('abc', 'a', 'x')); if (!Symbol.sham) { - assert.throws(() => startsWith(Symbol(), 'b'), 'throws on symbol context'); - assert.throws(() => startsWith('a', Symbol()), 'throws on symbol argument'); + const symbol = Symbol('startsWith test'); + assert.throws(() => startsWith(symbol, 'b'), 'throws on symbol context'); + assert.throws(() => startsWith('a', symbol), 'throws on symbol argument'); } if (STRICT) { diff --git a/tests/unit-pure/es.string.strike.js b/tests/unit-pure/es.string.strike.js index 576638b4ecf6..0c6aab235d69 100644 --- a/tests/unit-pure/es.string.strike.js +++ b/tests/unit-pure/es.string.strike.js @@ -6,6 +6,6 @@ QUnit.test('String#strike', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => strike(Symbol()), 'throws on symbol context'); + assert.throws(() => strike(Symbol('strike test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.sub.js b/tests/unit-pure/es.string.sub.js index 1bcb53a28027..3cf8f5194501 100644 --- a/tests/unit-pure/es.string.sub.js +++ b/tests/unit-pure/es.string.sub.js @@ -6,6 +6,6 @@ QUnit.test('String#sub', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => sub(Symbol()), 'throws on symbol context'); + assert.throws(() => sub(Symbol('sub test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.substr.js b/tests/unit-pure/es.string.substr.js index 6ea8f010233a..d9b1d7fde206 100644 --- a/tests/unit-pure/es.string.substr.js +++ b/tests/unit-pure/es.string.substr.js @@ -10,7 +10,7 @@ QUnit.test('String#substr', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => substr(Symbol(), 1, 3), 'throws on symbol context'); + assert.throws(() => substr(Symbol('substr test'), 1, 3), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-pure/es.string.sup.js b/tests/unit-pure/es.string.sup.js index a677c05f64eb..8c81206accdc 100644 --- a/tests/unit-pure/es.string.sup.js +++ b/tests/unit-pure/es.string.sup.js @@ -6,6 +6,6 @@ QUnit.test('String#sup', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => sup(Symbol()), 'throws on symbol context'); + assert.throws(() => sup(Symbol('sup test')), 'throws on symbol context'); } }); diff --git a/tests/unit-pure/es.string.to-well-formed.js b/tests/unit-pure/es.string.to-well-formed.js index 773b84d491f4..9d72f6110064 100644 --- a/tests/unit-pure/es.string.to-well-formed.js +++ b/tests/unit-pure/es.string.to-well-formed.js @@ -33,5 +33,5 @@ QUnit.test('String#toWellFormed', assert => { assert.throws(() => toWellFormed.call(undefined), TypeError, 'coercible #2'); } - assert.throws(() => toWellFormed.call(Symbol()), 'throws on symbol context'); + assert.throws(() => toWellFormed.call(Symbol('toWellFormed test')), 'throws on symbol context'); }); diff --git a/tests/unit-pure/es.string.trim-end.js b/tests/unit-pure/es.string.trim-end.js index d772c8cebd82..deb51d3a252e 100644 --- a/tests/unit-pure/es.string.trim-end.js +++ b/tests/unit-pure/es.string.trim-end.js @@ -9,7 +9,7 @@ QUnit.test('String#trimEnd', assert => { assert.same(trimEnd(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimEnd('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimEnd(Symbol()), 'throws on symbol context'); + assert.throws(() => trimEnd(Symbol('trimEnd test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimEnd(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.trim-left.js b/tests/unit-pure/es.string.trim-left.js index 3a875b6425b4..a28fa071739f 100644 --- a/tests/unit-pure/es.string.trim-left.js +++ b/tests/unit-pure/es.string.trim-left.js @@ -9,7 +9,7 @@ QUnit.test('String#trimLeft', assert => { assert.same(trimLeft(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimLeft('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimLeft(Symbol()), 'throws on symbol context'); + assert.throws(() => trimLeft(Symbol('trimLeft test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimLeft(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.trim-right.js b/tests/unit-pure/es.string.trim-right.js index 19794d2389b9..a3d47e11d64d 100644 --- a/tests/unit-pure/es.string.trim-right.js +++ b/tests/unit-pure/es.string.trim-right.js @@ -9,7 +9,7 @@ QUnit.test('String#trimRight', assert => { assert.same(trimRight(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimRight('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimRight(Symbol()), 'throws on symbol context'); + assert.throws(() => trimRight(Symbol('trimRight test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimRight(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.trim-start.js b/tests/unit-pure/es.string.trim-start.js index db24a7eaf105..4cb01d243d6b 100644 --- a/tests/unit-pure/es.string.trim-start.js +++ b/tests/unit-pure/es.string.trim-start.js @@ -9,7 +9,7 @@ QUnit.test('String#trimStart', assert => { assert.same(trimStart(WHITESPACES), '', 'removes all whitespaces'); assert.same(trimStart('\u200B\u0085'), '\u200B\u0085', "shouldn't remove this symbols"); - assert.throws(() => trimStart(Symbol()), 'throws on symbol context'); + assert.throws(() => trimStart(Symbol('trimStart test')), 'throws on symbol context'); if (STRICT) { assert.throws(() => trimStart(null, 0), TypeError); diff --git a/tests/unit-pure/es.string.trim.js b/tests/unit-pure/es.string.trim.js index c9da0ea8dab8..837f10c78080 100644 --- a/tests/unit-pure/es.string.trim.js +++ b/tests/unit-pure/es.string.trim.js @@ -10,7 +10,7 @@ QUnit.test('String#trim', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => trim(Symbol()), 'throws on symbol context'); + assert.throws(() => trim(Symbol('trim test')), 'throws on symbol context'); } if (STRICT) { diff --git a/tests/unit-pure/es.symbol.constructor.js b/tests/unit-pure/es.symbol.constructor.js index 59776817b766..d52ac5cd8e14 100644 --- a/tests/unit-pure/es.symbol.constructor.js +++ b/tests/unit-pure/es.symbol.constructor.js @@ -53,7 +53,7 @@ QUnit.test('Well-known Symbols', assert => { }); QUnit.test('Symbol#@@toPrimitive', assert => { - const symbol = Symbol(); + const symbol = Symbol('Symbol#@@toPrimitive test'); assert.isFunction(Symbol.prototype[Symbol.toPrimitive]); assert.same(symbol, symbol[Symbol.toPrimitive](), 'works'); }); @@ -227,6 +227,6 @@ if (DESCRIPTORS) { }); QUnit.test('Symbol.sham flag', assert => { - assert.same(Symbol.sham, typeof Symbol() == 'symbol' ? undefined : true); + assert.same(Symbol.sham, typeof Symbol('Symbol.sham flag test') == 'symbol' ? undefined : true); }); } diff --git a/tests/unit-pure/es.unescape.js b/tests/unit-pure/es.unescape.js index 3f6834e8c214..d1cd6f2de837 100644 --- a/tests/unit-pure/es.unescape.js +++ b/tests/unit-pure/es.unescape.js @@ -10,6 +10,6 @@ QUnit.test('unescape', assert => { /* eslint-disable es/no-symbol -- safe */ if (typeof Symbol == 'function') { - assert.throws(() => unescape(Symbol()), 'throws on symbol argument'); + assert.throws(() => unescape(Symbol('unescape test')), 'throws on symbol argument'); } }); diff --git a/tests/unit-pure/esnext.json.is-raw-json.js b/tests/unit-pure/esnext.json.is-raw-json.js index 791547f5e7ab..e5ac0e6fc27e 100644 --- a/tests/unit-pure/esnext.json.is-raw-json.js +++ b/tests/unit-pure/esnext.json.is-raw-json.js @@ -16,7 +16,7 @@ QUnit.test('JSON.rawJSON', assert => { assert.false(isRawJSON(1), 'number'); assert.false(isRawJSON('qwe'), 'string'); assert.false(isRawJSON(true), 'bool'); - assert.false(isRawJSON(Symbol()), 'sym'); + assert.false(isRawJSON(Symbol('JSON.isRawJSON test')), 'sym'); assert.false(isRawJSON({}), 'object'); assert.false(isRawJSON([]), 'array'); }); diff --git a/tests/unit-pure/esnext.json.parse.js b/tests/unit-pure/esnext.json.parse.js index e973ae3a5648..d2773ada69e4 100644 --- a/tests/unit-pure/esnext.json.parse.js +++ b/tests/unit-pure/esnext.json.parse.js @@ -129,7 +129,7 @@ QUnit.test('JSON.parse', assert => { assert.same(parse(-0, reviver), 0, `negative-zero-5 ${ note }`); assert.throws(() => parse(undefined, reviver), SyntaxError, `undefined ${ note }`); - assert.throws(() => parse(Symbol(), reviver), TypeError, `symbol ${ note }`); + assert.throws(() => parse(Symbol('JSON.parse test'), reviver), TypeError, `symbol ${ note }`); assert.same(parse(null, reviver), null, `null ${ note }`); assert.same(parse(false, reviver), false, `false ${ note }`); assert.same(parse(true, reviver), true, `true ${ note }`); diff --git a/tests/unit-pure/esnext.string.cooked.js b/tests/unit-pure/esnext.string.cooked.js index 3493ee59877b..7dd76a1af6a2 100644 --- a/tests/unit-pure/esnext.string.cooked.js +++ b/tests/unit-pure/esnext.string.cooked.js @@ -11,8 +11,9 @@ QUnit.test('String.cooked', assert => { assert.same(cooked([]), '', 'empty template'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => cooked([Symbol()]), TypeError, 'throws on symbol #1'); - assert.throws(() => cooked('test', Symbol()), TypeError, 'throws on symbol #2'); + const symbol = Symbol('cooked test'); + assert.throws(() => cooked([symbol]), TypeError, 'throws on symbol #1'); + assert.throws(() => cooked('test', symbol), TypeError, 'throws on symbol #2'); } assert.throws(() => cooked([undefined]), TypeError); diff --git a/tests/unit-pure/esnext.string.dedent.js b/tests/unit-pure/esnext.string.dedent.js index d1794ce6d721..b40af194b65b 100644 --- a/tests/unit-pure/esnext.string.dedent.js +++ b/tests/unit-pure/esnext.string.dedent.js @@ -42,7 +42,7 @@ QUnit.test('String.dedent', assert => { assert.same(dedent(tag), dedent(tag), '#7'); if (typeof Symbol == 'function' && !Symbol.sham) { - assert.throws(() => dedent({ raw: freeze(['\n', Symbol(), '\n']) }), TypeError, 'throws on symbol'); + assert.throws(() => dedent({ raw: freeze(['\n', Symbol('dedent test'), '\n']) }), TypeError, 'throws on symbol'); } assert.throws(() => dedent([]), TypeError, '[]'); diff --git a/tests/unit-pure/esnext.suppressed-error.constructor.js b/tests/unit-pure/esnext.suppressed-error.constructor.js index 8f0cbcd05739..df80f1c33c60 100644 --- a/tests/unit-pure/esnext.suppressed-error.constructor.js +++ b/tests/unit-pure/esnext.suppressed-error.constructor.js @@ -39,7 +39,7 @@ QUnit.test('SuppressedError', assert => { assert.same(error2.cause, undefined); assert.same(error2.name, 'SuppressedError'); - assert.throws(() => SuppressedError(1, 2, Symbol()), 'throws on symbol as a message'); + assert.throws(() => SuppressedError(1, 2, Symbol('SuppressedError constructor test')), 'throws on symbol as a message'); assert.same(toString(SuppressedError()), '[object Error]', 'Object#toString'); // eslint-disable-next-line no-prototype-builtins -- safe diff --git a/tests/unit-pure/esnext.symbol.is-registered-symbol.js b/tests/unit-pure/esnext.symbol.is-registered-symbol.js index e650564ed960..1c7ad855429a 100644 --- a/tests/unit-pure/esnext.symbol.is-registered-symbol.js +++ b/tests/unit-pure/esnext.symbol.is-registered-symbol.js @@ -6,10 +6,11 @@ QUnit.test('Symbol.isRegisteredSymbol', assert => { assert.arity(isRegisteredSymbol, 1, 'Symbol.isRegisteredSymbol arity is 1'); assert.name(isRegisteredSymbol, 'isRegisteredSymbol', 'Symbol.isRegisteredSymbol.name is "isRegisteredSymbol"'); - assert.true(isRegisteredSymbol(Symbol.for('foo')), 'registered-1'); - assert.true(isRegisteredSymbol(Object(Symbol.for('foo'))), 'registered-2'); - assert.false(isRegisteredSymbol(Symbol()), 'non-registered'); - assert.false(isRegisteredSymbol(Object(Symbol())), 'non-registered'); + assert.true(isRegisteredSymbol(Symbol.for('foo')), 'registered'); + assert.true(isRegisteredSymbol(Object(Symbol.for('foo'))), 'registered, boxed'); + const symbol = Symbol('Symbol.isRegisteredSymbol test'); + assert.false(isRegisteredSymbol(symbol), 'non-registered'); + assert.false(isRegisteredSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isRegisteredSymbol(1), '1'); assert.false(isRegisteredSymbol(true), 'true'); assert.false(isRegisteredSymbol('1'), 'string'); diff --git a/tests/unit-pure/esnext.symbol.is-registered.js b/tests/unit-pure/esnext.symbol.is-registered.js index 5467773f629e..b9aeae5e8eb6 100644 --- a/tests/unit-pure/esnext.symbol.is-registered.js +++ b/tests/unit-pure/esnext.symbol.is-registered.js @@ -6,10 +6,11 @@ QUnit.test('Symbol.isRegistered', assert => { assert.arity(isRegistered, 1, 'Symbol.isRegistered arity is 1'); assert.name(isRegistered, 'isRegisteredSymbol', 'Symbol.isRegistered.name is "isRegisteredSymbol"'); - assert.true(isRegistered(Symbol.for('foo')), 'registered-1'); - assert.true(isRegistered(Object(Symbol.for('foo'))), 'registered-2'); - assert.false(isRegistered(Symbol()), 'non-registered'); - assert.false(isRegistered(Object(Symbol())), 'non-registered'); + assert.true(isRegistered(Symbol.for('foo')), 'registered'); + assert.true(isRegistered(Object(Symbol.for('foo'))), 'registered, boxed'); + const symbol = Symbol('Symbol.isRegistered test'); + assert.false(isRegistered(symbol), 'non-registered'); + assert.false(isRegistered(Object(symbol)), 'non-registered, boxed'); assert.false(isRegistered(1), '1'); assert.false(isRegistered(true), 'true'); assert.false(isRegistered('1'), 'string'); diff --git a/tests/unit-pure/esnext.symbol.is-well-known-symbol.js b/tests/unit-pure/esnext.symbol.is-well-known-symbol.js index 7c9cb1beef3c..8cc9ff0d3a3d 100644 --- a/tests/unit-pure/esnext.symbol.is-well-known-symbol.js +++ b/tests/unit-pure/esnext.symbol.is-well-known-symbol.js @@ -7,11 +7,12 @@ QUnit.test('Symbol.isWellKnownSymbol', assert => { assert.name(isWellKnownSymbol, 'isWellKnownSymbol', 'Symbol.isWellKnownSymbol.name is "isWellKnownSymbol"'); assert.true(isWellKnownSymbol(Symbol.iterator), 'registered-1'); - assert.true(isWellKnownSymbol(Object(Symbol.iterator)), 'registered-2'); + assert.true(isWellKnownSymbol(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnownSymbol(Symbol.patternMatch), 'registered-3'); - assert.true(isWellKnownSymbol(Object(Symbol.patternMatch)), 'registered-4'); - assert.false(isWellKnownSymbol(Symbol()), 'non-registered'); - assert.false(isWellKnownSymbol(Object(Symbol())), 'non-registered'); + assert.true(isWellKnownSymbol(Object(Symbol.patternMatch)), 'registered-4, boxed'); + const symbol = Symbol('Symbol.isWellKnownSymbol test'); + assert.false(isWellKnownSymbol(symbol), 'non-registered'); + assert.false(isWellKnownSymbol(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnownSymbol(1), '1'); assert.false(isWellKnownSymbol(true), 'true'); assert.false(isWellKnownSymbol('1'), 'string'); diff --git a/tests/unit-pure/esnext.symbol.is-well-known.js b/tests/unit-pure/esnext.symbol.is-well-known.js index 4d255885017f..89a1dfec0bcc 100644 --- a/tests/unit-pure/esnext.symbol.is-well-known.js +++ b/tests/unit-pure/esnext.symbol.is-well-known.js @@ -7,11 +7,12 @@ QUnit.test('Symbol.isWellKnown', assert => { assert.name(isWellKnown, 'isWellKnownSymbol', 'Symbol.isWellKnown.name is "isWellKnownSymbol"'); assert.true(isWellKnown(Symbol.iterator), 'registered-1'); - assert.true(isWellKnown(Object(Symbol.iterator)), 'registered-2'); + assert.true(isWellKnown(Object(Symbol.iterator)), 'registered-2, boxed'); assert.true(isWellKnown(Symbol.patternMatch), 'registered-3'); - assert.true(isWellKnown(Object(Symbol.patternMatch)), 'registered-4'); - assert.false(isWellKnown(Symbol()), 'non-registered'); - assert.false(isWellKnown(Object(Symbol())), 'non-registered'); + assert.true(isWellKnown(Object(Symbol.patternMatch)), 'registered-4, boxed'); + const symbol = Symbol('Symbol.isWellKnown test'); + assert.false(isWellKnown(symbol), 'non-registered'); + assert.false(isWellKnown(Object(symbol)), 'non-registered, boxed'); assert.false(isWellKnown(1), '1'); assert.false(isWellKnown(true), 'true'); assert.false(isWellKnown('1'), 'string'); diff --git a/tests/unit-pure/web.dom-exception.constructor.js b/tests/unit-pure/web.dom-exception.constructor.js index 6283d56d5b9c..4c61fc10adcf 100644 --- a/tests/unit-pure/web.dom-exception.constructor.js +++ b/tests/unit-pure/web.dom-exception.constructor.js @@ -68,8 +68,9 @@ QUnit.test('DOMException', assert => { } assert.throws(() => DOMException(42, 'DataCloneError'), "DOMException(42, 'DataCloneError')"); - assert.throws(() => new DOMException(Symbol(), 'DataCloneError'), "new DOMException(Symbol(), 'DataCloneError')"); - assert.throws(() => new DOMException(42, Symbol()), 'new DOMException(42, Symbol())'); + const symbol = Symbol('DOMException constructor test'); + assert.throws(() => new DOMException(symbol, 'DataCloneError'), "new DOMException(Symbol(), 'DataCloneError')"); + assert.throws(() => new DOMException(42, symbol), 'new DOMException(42, Symbol())'); if (DESCRIPTORS) { // assert.throws(() => DOMException.prototype.message, 'DOMException.prototype.message'); // FF55- , Safari 10.1 bug // assert.throws(() => DOMException.prototype.name, 'DOMException.prototype.name'); // FF55-, Safari 10.1 bug bug