summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js')
-rw-r--r--js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js b/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js
new file mode 100644
index 0000000000..b32c085afa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/S12.6.4_A6.1.js
@@ -0,0 +1,44 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ The production IterationStatement: "for (var VariableDeclarationNoIn in
+ Expression) Statement"
+es5id: 12.6.4_A6.1
+description: >
+ Using Object with custom prototype as an Expression is
+ appropriate. The prototype is "{feat:2,hint:"protohint"}"
+---*/
+
+var __accum;
+
+function FACTORY(){this.prop=1;this.hint="hinted"};
+
+FACTORY.prototype = {feat:2,hint:"protohint"};
+
+var __instance = new FACTORY;
+
+__accum="";
+
+for (var key in __instance){
+ __accum+=(key + __instance[key]);
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#1
+if (!((__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1))) {
+ throw new Test262Error('#1: (__accum.indexOf("prop1")!==-1)&&(__accum.indexOf("feat2")!==-1)&&(__accum.indexOf("hinthinted")!==-1)');
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//////////////////////////////////////////////////////////////////////////////
+//CHECK#2
+if (__accum.indexOf("hintprotohint")!==-1) {
+ throw new Test262Error('#2: __accum.indexOf("hintprotohint") === -1. Actual: __accum.indexOf("hintprotohint") ==='+ __accum.indexOf("hintprotohint") );
+}
+//
+//////////////////////////////////////////////////////////////////////////////
+
+reportCompare(0, 0);