mirror of
https://github.com/tc39/test262.git
synced 2025-07-09 15:14:39 +02:00
Verify that symbols are not callable (#2180)
This commit is contained in:
parent
6f4c0d96f7
commit
2ce56a5f64
34
test/built-ins/Symbol/not-callable.js
Normal file
34
test/built-ins/Symbol/not-callable.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (C) 2019 Aleksey Shvayka. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
esid: sec-properties-of-symbol-instances
|
||||||
|
description: >
|
||||||
|
Symbol primitives and objects are not callable.
|
||||||
|
info: |
|
||||||
|
Properties of Symbol Instances
|
||||||
|
|
||||||
|
Symbol instances are ordinary objects that inherit properties from the
|
||||||
|
Symbol prototype object. Symbol instances have a [[SymbolData]] internal slot.
|
||||||
|
The [[SymbolData]] internal slot is the Symbol value represented by this
|
||||||
|
Symbol object.
|
||||||
|
features: [Symbol]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var sym = Symbol('desc');
|
||||||
|
var symObj = Object(Symbol());
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
sym();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new sym();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
symObj();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
new symObj();
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user