js/src/tests/ecma_2/Exceptions/statement-006.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 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/. */
     7 /**
     8    File Name:          statement-006.js
     9    Corresponds To:     12.6.3-9-n.js
    10    ECMA Section:       12.6.3 The for...in Statement
    11    Description:
    13    Author:             christine@netscape.com
    14    Date:               11 september 1997
    15 */
    16 var SECTION = "statement-006";
    17 var VERSION = "JS1_4";
    18 var TITLE   = "The for..in statement";
    20 startTest();
    21 writeHeaderToLog( SECTION + " "+ TITLE);
    23 var result = "Failed";
    24 var exception = "No exception thrown";
    25 var expect = "Passed";
    27 try {
    28   var o = new MyObject();
    29   var result = 0;
    30   for ( var o in foo) {
    31     result += this[o];
    32   }
    33 } catch ( e ) {
    34   result = expect;
    35   exception = e.toString();
    36 }
    38 new TestCase(
    39   SECTION,
    40   "object is not defined" +
    41   " (threw " + exception +")",
    42   expect,
    43   result );
    45 test();
    47 function MyObject() {
    48   this.value = 2;
    49   this[0] = 4;
    50   return this;
    51 }

mercurial