tor-browser

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

argument-cast.js (1014B)


      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.plaintime.compare
      7 description: compare() casts its arguments
      8 features: [Temporal]
      9 ---*/
     10 
     11 const t1 = Temporal.PlainTime.from("08:44:15.321");
     12 const t2 = Temporal.PlainTime.from("14:23:30.123");
     13 
     14 assert.sameValue(Temporal.PlainTime.compare({ hour: 16, minute: 34 }, t2), 1, "one object");
     15 assert.sameValue(Temporal.PlainTime.compare("16:34", t2), 1, "one string");
     16 assert.throws(TypeError, () => Temporal.PlainTime.compare({ hours: 16 }, t2), "one missing property");
     17 
     18 assert.sameValue(Temporal.PlainTime.compare(t1, { hour: 16, minute: 34 }), -1, "two object");
     19 assert.sameValue(Temporal.PlainTime.compare(t1, "16:34"), -1, "two string");
     20 assert.throws(TypeError, () => Temporal.PlainTime.compare(t1, { hours: 16 }), "two missing property");
     21 
     22 reportCompare(0, 0);