Debian Codegraph @

rhino/testsrc/tests/ecma_2/Exceptions/statement-005.js

raw symbols SCIP
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 gTestfile = 'statement-005.js';
7
8 /**
9 File Name: statement-005.js
10 Corresponds To: 12.6.3-8-n.js
11 ECMA Section: 12.6.3 The for...in Statement
12 Description:
13 Author: [email protected]
14 Date: 11 september 1997
15 */
16 var SECTION = "statement-005";
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 result = 0;
30
31 eval("for (1 in o) {\n"
32 + "result += this[p];"
33 + "}\n");
34 } catch ( e ) {
35 result = expect;
36 exception = e.toString();
37 }
38
39 new TestCase(
40 SECTION,
41 "bad left-hand side expression" +
42 " (threw " + exception +")",
43 expect,
44 result );
45
46 test();
47
48 function MyObject() {
49 this.value = 2;
50 this[0] = 4;
51 return this;
52 }