Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/built-ins/Symbol/for/to-string-err.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-symbol.for
5 es6id: 19.4.2.1
6 description: Error resulting from string coercion of first argument
7 info: |
8 1. Let stringKey be ? ToString(key).
9 features: [Symbol]
10 ---*/
11
12 var subject = {
13 toString: function() {
14 throw new Test262Error();
15 }
16 };
17
18 assert.throws(Test262Error, function() {
19 Symbol.for(subject);
20 });
21
22 subject = Symbol('s');
23
24 assert.throws(TypeError, function() {
25 Symbol.for(subject);
26 });