v8/test/mjsunit/regress/regress-v8-12122.js
jameslahm 5e060e4152 [errors-test] Add test for correct 'Promise.allSettled.call()' error message
Originally, 'Promise.allSettled.call()' will throw
"Promise.all called on non-object". It should be
"Promise.allSettled called on non-object". Add test
for it.

Bug: v8:12122
Change-Id: I496a7c9d31baeb5b99012461387cfbccc4100d2b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3463063
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79096}
2022-02-15 11:07:34 +00:00

21 lines
777 B
JavaScript

// Copyright 2021 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.
const promiseAllCallOnNonObjectErrorMessage =
'Promise.all called on non-object';
const promiseAllSettledCallOnNonObjectErrorMessage =
'Promise.allSettled called on non-object';
assertThrows(
() => Promise.all.call(), TypeError, promiseAllCallOnNonObjectErrorMessage);
assertThrows(
() => Promise.allSettled.call(), TypeError,
promiseAllSettledCallOnNonObjectErrorMessage);
assertThrows(
() => Promise.all.apply(), TypeError,
promiseAllCallOnNonObjectErrorMessage);
assertThrows(
() => Promise.allSettled.apply(), TypeError,
promiseAllSettledCallOnNonObjectErrorMessage);