Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/es6/promise-allsettled-resolve-not-callable.js')
-rw-r--r--deps/v8/test/mjsunit/es6/promise-allsettled-resolve-not-callable.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/es6/promise-allsettled-resolve-not-callable.js b/deps/v8/test/mjsunit/es6/promise-allsettled-resolve-not-callable.js
new file mode 100644
index 00000000000..ed5868383db
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/promise-allsettled-resolve-not-callable.js
@@ -0,0 +1,30 @@
+// Copyright 2020 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+load('test/mjsunit/test-async.js');
+
+// Promise.allSettled should call IteratorClose if Promise.resolve is not callable.
+
+let returnCount = 0;
+let iter = {
+ [Symbol.iterator]() {
+ return {
+ return() {
+ returnCount++;
+ }
+ };
+ }
+};
+
+Promise.resolve = "certainly not callable";
+
+testAsync(assert => {
+ assert.plan(2);
+ Promise.allSettled(iter).then(assert.unreachable, reason => {
+ assert.equals(true, reason instanceof TypeError);
+ assert.equals(1, returnCount);
+ });
+});