summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js
blob: bd0a8bc86702b765ac8197f373cf490b6a4fb40d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// Copyright (C) 2018 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-symbol.prototype.description
description: >
  SymbolDescriptiveString(sym) via Symbol.prototype.toString()
info: |
  SymbolDescriptiveString ( sym )

  Assert: Type(sym) is Symbol.
  Let desc be sym's [[Description]] value.
  If desc is undefined, let desc be the empty string.
  Assert: Type(desc) is String.
  Return the string-concatenation of "Symbol(", desc, and ")".

features: [Symbol.prototype.description]
---*/

const symbol = Symbol('foo');

assert.sameValue(
  symbol.description,
  'foo',
  'The value of symbol.description is "foo"'
);
assert.sameValue(
  symbol.toString(),
  `Symbol(${symbol.description})`,
  `symbol.toString() returns "Symbol(${symbol.description})"`
);

reportCompare(0, 0);