tor-browser

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

basic-for-in.js (1059B)


      1 /* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 //-----------------------------------------------------------------------------
      7 var BUGNUMBER     = "346582";
      8 var summary = "Basic support for iterable objects and for-in";
      9 var actual, expect;
     10 
     11 printBugNumber(BUGNUMBER);
     12 printStatus(summary);
     13 
     14 /**************
     15 * BEGIN TEST *
     16 **************/
     17 
     18 var failed = false;
     19 
     20 var iterable = { persistedProp: 17 };
     21 
     22 try
     23 {
     24  // nothing unusual so far -- verify basic properties
     25  for (var i in iterable)
     26  {
     27    if (i != "persistedProp")
     28      throw "no persistedProp!";
     29    if (iterable[i] != 17)
     30      throw "iterable[\"persistedProp\"] == 17";
     31  }
     32 
     33  if (iterable.persistedProp != 17)
     34    throw "iterable.persistedProp not persisted!";
     35 }
     36 catch (e)
     37 {
     38  failed = e;
     39 }
     40 
     41 
     42 
     43 expect = false;
     44 actual = failed;
     45 
     46 reportCompare(expect, actual, summary);