summaryrefslogtreecommitdiff
path: root/test/built-ins/BigInt/new-target-throws.js
blob: aaf91b1174d0015b8e0ede0600fc9e2bba563ebf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (C) 2017 Robin Templeton. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
description: Throws a TypeError if BigInt is called with a new target
esid: sec-bigint-constructor
info: |
  1. If NewTarget is not undefined, throw a TypeError exception.
  ...
features: [BigInt]
---*/

assert.throws(TypeError, function() {
  new BigInt();
});

assert.throws(TypeError, function() {
  new BigInt({
    valueOf: function() {
      throw new Test262Error("unreachable");
    }
  });
});