Debian Codegraph @

js/src/tests/test262/built-ins/String/symbol-string-coercion.js

raw
1 // Copyright (C) 2016 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3 /*---
4 esid: sec-string-constructor
5 description: Symbol value may be coerced to a String
6 info: |
7 1. If no arguments were passed to this function invocation, let s be "".
8 2. Else,
9 a. If NewTarget is undefined and Type(value) is Symbol, return
10 SymbolDescriptiveString(value).
11 features: [Symbol]
12 ---*/
13
14 assert.sameValue(String(Symbol('66')), 'Symbol(66)');
15 assert.sameValue(String(Symbol()), 'Symbol()', 'implicit `undefined`');
16 assert.sameValue(
17 String(Symbol(undefined)), 'Symbol()', 'explicit `undefined`'
18 );
19
20 reportCompare(0, 0);