Skip to content

Commit 31cf2c9

Browse files
committed
Only test Symbol if it's supported
1 parent cbcb1ef commit 31cf2c9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

test/parallel/test-assert-deep.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,9 @@ assertNotDeepOrStrict(createSet([1, 2, 3, 4]), createSet([1, 2, 3]));
263263
assertDeepAndStrictEqual(createSet(['1', '2', '3']), createSet(['1', '2', '3']));
264264
assertDeepAndStrictEqual(createSet([[1, 2], [3, 4]]), createSet([[3, 4], [1, 2]]));
265265
assertNotDeepOrStrict(createSet([{ a: 0 }]), createSet([{ a: 1 }]));
266-
assertNotDeepOrStrict(createSet([Symbol()]), createSet([Symbol()]));
266+
if (common.symbolSupported) {
267+
assertNotDeepOrStrict(createSet([Symbol()]), createSet([Symbol()]));
268+
}
267269

268270
{
269271
const a = [ 1, 2 ];
@@ -633,7 +635,7 @@ assert.deepStrictEqual({ a: NaN }, { a: NaN });
633635
assert.deepStrictEqual([ 1, 2, NaN, 4 ], [ 1, 2, NaN, 4 ]);
634636

635637
// Handle boxed primitives
636-
{
638+
if (common.symbolSupported) {
637639
const boxedString = new String('test');
638640
const boxedSymbol = Object(Symbol());
639641
assertNotDeepOrStrict(new Boolean(true), Object(false));
@@ -656,7 +658,7 @@ assertOnlyDeepEqual(0, -0);
656658
assertDeepAndStrictEqual(-0, -0);
657659

658660
// Handle symbols (enumerable only)
659-
{
661+
if (common.symbolSupported) {
660662
const symbol1 = Symbol();
661663
const obj1 = { [symbol1]: 1 };
662664
const obj2 = { [symbol1]: 1 };
@@ -780,13 +782,15 @@ assertNotDeepOrStrict('a', ['a']);
780782
assertNotDeepOrStrict('a', { 0: 'a' });
781783
assertNotDeepOrStrict(1, {});
782784
assertNotDeepOrStrict(true, {});
783-
assertNotDeepOrStrict(Symbol(), {});
784-
assertNotDeepOrStrict(Symbol(), Symbol());
785+
if (common.symbolSupported) {
786+
assertNotDeepOrStrict(Symbol(), {});
787+
assertNotDeepOrStrict(Symbol(), Symbol());
788+
}
785789

786790
assertOnlyDeepEqual(4, '4');
787791
assertOnlyDeepEqual(true, 1);
788792

789-
{
793+
if (common.symbolSupported) {
790794
const s = Symbol();
791795
assertDeepAndStrictEqual(s, s);
792796
}
@@ -978,7 +982,7 @@ assert.deepStrictEqual(obj1, obj2);
978982
// Strict equal with identical objects that are not identical
979983
// by reference and longer than 30 elements
980984
// E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
981-
{
985+
if (common.symbolSupported) {
982986
const a = {};
983987
const b = {};
984988
for (let i = 0; i < 35; i++) {

0 commit comments

Comments
 (0)