tor-browser

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

argument-string-time-separators.js (1072B)


      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: Time separator in string argument can vary
      8 features: [Temporal]
      9 ---*/
     10 
     11 const plainTime = new Temporal.PlainTime(12, 34, 56, 987, 654, 321);
     12 const tests = [
     13  ["1976-11-18T12:34:56.987654321", "uppercase T"],
     14  ["1976-11-18t12:34:56.987654321", "lowercase T"],
     15  ["1976-11-18 12:34:56.987654321", "space between date and time"],
     16  ["T12:34:56.987654321", "time-only uppercase T"],
     17  ["t12:34:56.987654321", "time-only lowercase T"],
     18 ];
     19 
     20 tests.forEach(([arg, description]) => {
     21  assert.sameValue(
     22    Temporal.PlainTime.compare(arg, plainTime),
     23    0,
     24    `variant time separators (${description}), first argument`
     25  );
     26 
     27  assert.sameValue(
     28    Temporal.PlainTime.compare(plainTime, arg),
     29    0,
     30    `variant time separators (${description}), second argument`
     31  );
     32 });
     33 
     34 reportCompare(0, 0);