|
1 // Copyright 2009 the Sputnik authors. All rights reserved. |
|
2 // This code is governed by the BSD license found in the LICENSE file. |
|
3 |
|
4 /** |
|
5 * The production IterationStatement: "for (var VariableDeclarationNoIn in Expression) Statement" |
|
6 * |
|
7 * @path ch12/12.6/12.6.4/S12.6.4_A6.1.js |
|
8 * @description Using Object with custom prototype as an Expression is appropriate. The prototype is "{feat:2,hint:"protohint"}" |
|
9 */ |
|
10 |
|
11 function FACTORY(){this.prop=1;this.hint="hinted"}; |
|
12 |
|
13 FACTORY.prototype = {feat:2,hint:"protohint"}; |
|
14 |
|
15 var __instance = new FACTORY; |
|
16 |
|
17 __accum=""; |
|
18 |
|
19 for (var key in __instance){ |
|
20 __accum+=(key + __instance[key]); |
|
21 } |
|
22 |
|
23 ////////////////////////////////////////////////////////////////////////////// |
|
24 //CHECK#1 |
|
25 if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) { |
|
26 $ERROR('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)'); |
|
27 } |
|
28 // |
|
29 ////////////////////////////////////////////////////////////////////////////// |
|
30 |
|
31 ////////////////////////////////////////////////////////////////////////////// |
|
32 //CHECK#2 |
|
33 if (__accum.indexOf("hintprotohint")!==-1) { |
|
34 $ERROR('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") ); |
|
35 } |
|
36 // |
|
37 ////////////////////////////////////////////////////////////////////////////// |
|
38 |