tor-browser

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

length-with-destructuring-and-parameter-expression.js (1217B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 assertEq(function([a = 0]){}.length, 1);
      6 assertEq(function({p: a = 0}){}.length, 1);
      7 assertEq(function({a = 0}){}.length, 1);
      8 assertEq(function({[0]: a}){}.length, 1);
      9 
     10 assertEq(function([a = 0], [b = 0]){}.length, 2);
     11 assertEq(function({p: a = 0}, [b = 0]){}.length, 2);
     12 assertEq(function({a = 0}, [b = 0]){}.length, 2);
     13 assertEq(function({[0]: a}, [b = 0]){}.length, 2);
     14 
     15 assertEq(function(x, [a = 0]){}.length, 2);
     16 assertEq(function(x, {p: a = 0}){}.length, 2);
     17 assertEq(function(x, {a = 0}){}.length, 2);
     18 assertEq(function(x, {[0]: a}){}.length, 2);
     19 
     20 assertEq(function(x = 0, [a = 0]){}.length, 0);
     21 assertEq(function(x = 0, {p: a = 0}){}.length, 0);
     22 assertEq(function(x = 0, {a = 0}){}.length, 0);
     23 assertEq(function(x = 0, {[0]: a}){}.length, 0);
     24 
     25 assertEq(function([a = 0], ...r){}.length, 1);
     26 assertEq(function({p: a = 0}, ...r){}.length, 1);
     27 assertEq(function({a = 0}, ...r){}.length, 1);
     28 assertEq(function({[0]: a}, ...r){}.length, 1);
     29 
     30 if (typeof reportCompare === "function")
     31    reportCompare(0, 0);