initial import
[vuplus_webkit] / Source / JavaScriptCore / tests / mozilla / ecma_2 / Exceptions / statement-006.js
1 /**
2     File Name:          statement-006.js
3     Corresponds To:     12.6.3-9-n.js
4     ECMA Section:       12.6.3 The for...in Statement
5     Description:
6
7     Author:             christine@netscape.com
8     Date:               11 september 1997
9 */
10     var SECTION = "statement-006";
11     var VERSION = "JS1_4";
12     var TITLE   = "The for..in statment";
13
14     startTest();
15     writeHeaderToLog( SECTION + " "+ TITLE);
16
17     var tc = 0;
18     var testcases = new Array();
19
20     var result = "Failed";
21     var exception = "No exception thrown";
22     var expect = "Passed";
23
24     try {
25         var o = new MyObject();
26         var result = 0;
27         for ( var o in foo) {
28             result += this[o];
29         }
30     } catch ( e ) {
31         result = expect;
32         exception = e.toString();
33     }
34
35     testcases[tc++] = new TestCase(
36         SECTION,
37         "object is not defined" +
38         " (threw " + exception +")",
39         expect,
40         result );
41
42     test();
43
44 function MyObject() {
45     this.value = 2;
46     this[0] = 4;
47     return this;
48 }