From 2acbd3e98e74215c7a01b2a494dc256f94b36b1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Bargull?= <andre.bargull@gmail.com>
Date: Tue, 1 Mar 2016 19:15:21 +0100
Subject: [PATCH] Improve coverage for default class constructors

---
 .../default-constructor-spread-override.js    | 57 +++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100755 test/language/statements/class/subclass/default-constructor-spread-override.js

diff --git a/test/language/statements/class/subclass/default-constructor-spread-override.js b/test/language/statements/class/subclass/default-constructor-spread-override.js
new file mode 100755
index 0000000000..f838816916
--- /dev/null
+++ b/test/language/statements/class/subclass/default-constructor-spread-override.js
@@ -0,0 +1,57 @@
+// Copyright (C) 2016 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-runtime-semantics-classdefinitionevaluation
+description: >
+  Default class constructor uses standard iterator spread semantics.
+info: >
+  14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+    ...
+    10. If constructor is empty, then
+      a. If ClassHeritageopt is present, then
+          i Let constructor be the result of parsing the source text
+              constructor(...args){ super(...args); }
+            using the syntactic grammar with the goal symbol MethodDefinition.
+    ...
+
+  14.1.19 Runtime Semantics: IteratorBindingInitialization
+    `FunctionRestParameter : BindingRestElement`
+    ...
+    9. Let result be the result of performing IteratorBindingInitialization for BindingRestElement using iteratorRecord and environment as the arguments.
+    ...
+
+  13.3.3.6 Runtime Semantics: IteratorBindingInitialization
+    `BindingRestElement : ...BindingIdentifier`
+    ...
+    2. Let A be ArrayCreate(0).
+    ...
+
+  12.3.6.1 Runtime Semantics: ArgumentListEvaluation
+    `ArgumentList : ArgumentList , ...AssignmentExpression`
+    ...
+    3. Let iterator be ? GetIterator(? GetValue(spreadRef)).
+    ...
+features: [Symbol.iterator]
+---*/
+
+var arrayIterator = Array.prototype[Symbol.iterator];
+
+// Redefine Array iterator to change the result of spreading `args` in `super(...args)`.
+Array.prototype[Symbol.iterator] = function() {
+  return arrayIterator.call(["spread-value"]);
+};
+
+var receivedValue;
+
+class Base {
+  constructor(value) {
+    receivedValue = value;
+  }
+}
+
+class Derived extends Base {}
+
+new Derived();
+
+assert.sameValue(receivedValue, "spread-value");
-- 
GitLab