tor-browser

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

set.js (880B)


      1 // Copyright (C) 2015 the V8 project authors. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 description: >
      6    Set instances should be able to be traversed using a `for...of` loop.
      7 es6id: 13.6.4
      8 features: [Set]
      9 ---*/
     10 
     11 var set = new Set();
     12 var obj = {};
     13 var iterationCount = 0;
     14 
     15 var first = 0;
     16 var second = 'a';
     17 var third = true;
     18 var fourth = false;
     19 var fifth = null;
     20 var sixth = undefined;
     21 var seventh = NaN;
     22 var eight = obj;
     23 
     24 set.add(0);
     25 set.add('a');
     26 set.add(true);
     27 set.add(false);
     28 set.add(null);
     29 set.add(undefined);
     30 set.add(NaN);
     31 set.add(obj);
     32 
     33 for (var x of set) {
     34  assert.sameValue(x, first);
     35  first = second;
     36  second = third;
     37  third = fourth;
     38  fourth = fifth;
     39  fifth = sixth;
     40  sixth = seventh;
     41  seventh = eight;
     42  eight = null;
     43  iterationCount += 1;
     44 }
     45 
     46 assert.sameValue(iterationCount, 8);
     47 
     48 reportCompare(0, 0);