summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/for-in/head-decl-expr.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/statements/for-in/head-decl-expr.js')
-rw-r--r--js/src/tests/test262/language/statements/for-in/head-decl-expr.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/for-in/head-decl-expr.js b/js/src/tests/test262/language/statements/for-in/head-decl-expr.js
new file mode 100644
index 0000000000..7208b10a5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/for-in/head-decl-expr.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Expression is allowed in head
+info: |
+ IterationStatement : for ( ForDeclaration in Expression ) Statement
+
+ 1. Let keyResult be the result of performing
+ ForIn/OfHeadEvaluation(BoundNames of ForDeclaration, Expression,
+ enumerate).
+ 2. ReturnIfAbrupt(keyResult).
+ 3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
+ lexicalBinding, labelSet).
+es6id: 13.7.5.11
+---*/
+
+var iterCount = 0;
+
+for (let x in null, { key: 0 }) {
+ assert.sameValue(x, 'key');
+ iterCount += 1;
+}
+
+assert.sameValue(iterCount, 1);
+
+reportCompare(0, 0);