diff options
Diffstat (limited to 'js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js')
-rw-r--r-- | js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js b/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js new file mode 100644 index 0000000000..bd0a8bc867 --- /dev/null +++ b/js/src/tests/test262/built-ins/Symbol/prototype/description/description-symboldescriptivestring.js @@ -0,0 +1,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); |