Debian Codegraph @

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