tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bigint-throws.js (852B)


      1 // Copyright (C) 2017 Robin Templeton. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 /*---
      4 description: The Unary + Operator throws a TypeError on BigInt numbers
      5 esid: sec-unary-plus-operator-runtime-semantics-evaluation
      6 info: |
      7  UnaryExpression: + UnaryExpression
      8 
      9  1. Let expr be the result of evaluating UnaryExpression.
     10  2. Return ? ToNumber(? GetValue(expr)).
     11 
     12  ToNumber ( argument )
     13 
     14  BigInt: Throw a TypeError exception
     15 features: [BigInt]
     16 ---*/
     17 assert.throws(TypeError, function() {
     18  +0n;
     19 }, '+0n throws TypeError');
     20 
     21 assert.throws(TypeError, function() {
     22  +1n;
     23 }, '+1n throws TypeError');
     24 
     25 assert.throws(TypeError, function() {
     26  +-1n;
     27 }, '+-1n throws TypeError');
     28 
     29 assert.throws(TypeError, function() {
     30  +1000000000000000n;
     31 }, '+1000000000000000n throws TypeError');
     32 
     33 reportCompare(0, 0);