summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Symbol/not-callable.js
blob: 56fe2a3749873b57acf952c7ec4490cc4da130c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// 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();
});

reportCompare(0, 0);