tor-browser

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

basic-shortest.js (946B)


      1 // Copyright (C) 2025 André Bargull. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-iterator.zipkeyed
      6 description: >
      7  Basic Iterator.zipkeyed test with "shortest" mode.
      8 includes: [compareArray.js, propertyHelper.js, iteratorZipUtils.js]
      9 features: [joint-iteration]
     10 ---*/
     11 
     12 function testSequence(inputs, inputsLabel, minLength, maxLength) {
     13  function test(options, optionsLabel) {
     14    var label = optionsLabel + ", " + inputsLabel;
     15    var it = Iterator.zipKeyed(inputs, options);
     16    assertZippedKeyed(it, inputs, minLength, label);
     17 
     18    // Iterator is closed after `minLength` items.
     19    assertIteratorResult(it.next(), undefined, true, label + ": after completion");
     20  }
     21 
     22  test(undefined, "options = undefined");
     23 
     24  test({}, "options = {}");
     25 
     26  test({ mode: "shortest" }, "options = { mode: 'shortest' }");
     27 }
     28 
     29 forEachSequenceCombinationKeyed(testSequence);
     30 
     31 reportCompare(0, 0);