]>
Commit | Line | Data |
---|---|---|
b37bf2e1 A |
1 | /** |
2 | File Name: statement-005.js | |
3 | Corresponds To: 12.6.3-8-n.js | |
4 | ECMA Section: 12.6.3 The for...in Statement | |
5 | Description: | |
6 | Author: christine@netscape.com | |
7 | Date: 11 september 1997 | |
8 | */ | |
9 | var SECTION = "statement-005"; | |
10 | var VERSION = "JS1_4"; | |
11 | var TITLE = "The for..in statment"; | |
12 | ||
13 | startTest(); | |
14 | writeHeaderToLog( SECTION + " "+ TITLE); | |
15 | ||
16 | var testcases = new Array(); | |
17 | var tc = 0; | |
18 | ||
19 | var result = "Failed"; | |
20 | var exception = "No exception thrown"; | |
21 | var expect = "Passed"; | |
22 | ||
23 | try { | |
24 | var o = new MyObject(); | |
25 | result = 0; | |
26 | ||
27 | eval("for (1 in o) {\n" | |
28 | + "result += this[p];" | |
29 | + "}\n"); | |
30 | } catch ( e ) { | |
31 | result = expect; | |
32 | exception = e.toString(); | |
33 | } | |
34 | ||
35 | testcases[tc++] = new TestCase( | |
36 | SECTION, | |
37 | "bad left-hand side expression" + | |
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 | } |