tor-browser

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

argument-number.js (940B)


      1 // |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
      2 // Copyright (C) 2022 Igalia, S.L. All rights reserved.
      3 // This code is governed by the BSD license found in the LICENSE file.
      4 
      5 /*---
      6 esid: sec-temporal.plainyearmonth.compare
      7 description: A number is invalid in place of an ISO string for Temporal.PlainYearMonth
      8 features: [Temporal]
      9 ---*/
     10 
     11 const arg = 201906;
     12 
     13 const numbers = [
     14  1,
     15  201906,
     16  -201906,
     17  1234567,
     18 ];
     19 
     20 for (const arg of numbers) {
     21  assert.throws(
     22    TypeError,
     23    () => Temporal.PlainYearMonth.compare(arg, new Temporal.PlainYearMonth(2019, 6)),
     24    `A number (${arg}) is not a valid ISO string for PlainYearMonth (first argument)`
     25  );
     26  assert.throws(
     27    TypeError,
     28    () => Temporal.PlainYearMonth.compare(new Temporal.PlainYearMonth(2019, 6), arg),
     29    `A number (${arg}) is not a valid ISO string for PlainYearMonth (first argument)`
     30  );
     31 }
     32 
     33 reportCompare(0, 0);