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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:3269807aedaf
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/. */
5
6
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:
12
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";
19
20 startTest();
21 writeHeaderToLog( SECTION + " "+ TITLE);
22
23 var result = "Failed";
24 var exception = "No exception thrown";
25 var expect = "Passed";
26
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 }
37
38 new TestCase(
39 SECTION,
40 "object is not defined" +
41 " (threw " + exception +")",
42 expect,
43 result );
44
45 test();
46
47 function MyObject() {
48 this.value = 2;
49 this[0] = 4;
50 return this;
51 }

mercurial