Debian Codegraph @

js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js

raw
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 info: |
6 The production IterationStatement: "for (var VariableDeclarationNoIn in
7 Expression) Statement"
8 es5id: 12.6.4_A6.1
9 description: >
10 Using Object with custom prototype as an Expression is
11 appropriate. The prototype is "{feat:2,hint:"protohint"}"
12 ---*/
13
14 var __accum;
15
16 function FACTORY(){this.prop=1;this.hint="hinted"};
17
18 FACTORY.prototype = {feat:2,hint:"protohint"};
19
20 var __instance = new FACTORY;
21
22 __accum="";
23
24 for (var key in __instance){
25 __accum+=(key + __instance[key]);
26 }
27
28 //////////////////////////////////////////////////////////////////////////////
29 //CHECK#1
30 if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) {
31 throw new Test262Error('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)');
32 }
33 //
34 //////////////////////////////////////////////////////////////////////////////
35
36 //////////////////////////////////////////////////////////////////////////////
37 //CHECK#2
38 if (__accum.indexOf("hintprotohint")!==-1) {
39 throw new Test262Error('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") );
40 }
41 //
42 //////////////////////////////////////////////////////////////////////////////
43
44 reportCompare(0, 0);