[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}
This commit is contained in:
jameslahm 2022-02-15 18:18:52 +08:00 committed by V8 LUCI CQ
parent d7b2dd098a
commit 5e060e4152

View File

@ -0,0 +1,20 @@
// 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);