tests/auto/qml/ecmascripttests/test262/test/built-ins/WeakSet/symbol-disallowed-as-weakset-key.js
raw| 1 | // Copyright (C) 2013 the V8 project authors. All rights reserved. |
| 2 | // This code is governed by the BSD license found in the LICENSE file. |
| 3 | /*--- |
| 4 | es6id: 23.4.3.1_S2 |
| 5 | esid: sec-weakset.prototype.add |
| 6 | description: > |
| 7 | Symbol may not be used as a WeakSet entry |
| 8 | features: [Symbol, WeakSet] |
| 9 | ---*/ |
| 10 | var weakset = new WeakSet(); |
| 11 | var sym = Symbol(); |
| 12 | |
| 13 | assert.throws(TypeError, function() { |
| 14 | weakset.add(sym); |
| 15 | }); |