1 /*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "ecmascript/base/error_helper.h"
17 #include "ecmascript/global_env.h"
18 #include "ecmascript/tests/test_helper.h"
19
20 using namespace panda::ecmascript;
21 using namespace panda::ecmascript::base;
22
23 namespace panda::test {
24 class ErrorHelperTest : public testing::Test {
25 public:
SetUpTestCase()26 static void SetUpTestCase()
27 {
28 GTEST_LOG_(INFO) << "SetUpTestCase";
29 }
30
TearDownTestCase()31 static void TearDownTestCase()
32 {
33 GTEST_LOG_(INFO) << "TearDownCase";
34 }
35
SetUp()36 void SetUp() override
37 {
38 TestHelper::CreateEcmaVMWithScope(instance, thread, scope);
39 }
40
TearDown()41 void TearDown() override
42 {
43 TestHelper::DestroyEcmaVMWithScope(instance, scope);
44 }
45
46 EcmaVM *instance {nullptr};
47 EcmaHandleScope *scope {nullptr};
48 JSThread *thread {nullptr};
49 };
50
HWTEST_F_L0(ErrorHelperTest,ErrorCommonToString_001)51 HWTEST_F_L0(ErrorHelperTest, ErrorCommonToString_001)
52 {
53 auto factory = instance->GetFactory();
54 auto env = instance->GetGlobalEnv();
55 JSHandle<JSTaggedValue> errorFunc = env->GetErrorFunction();
56 JSHandle<JSTaggedValue> evalErrorFunc = env->GetEvalErrorFunction();
57 JSHandle<JSTaggedValue> typeErrorFunc = env->GetTypeErrorFunction();
58 JSHandle<JSTaggedValue> rangeErrorFunc = env->GetRangeErrorFunction();
59 JSHandle<JSObject> errorObj = factory->NewJSObjectByConstructor(JSHandle<JSFunction>(errorFunc), errorFunc);
60 JSHandle<JSObject> evalErrorObj =
61 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(evalErrorFunc), evalErrorFunc);
62 JSHandle<JSObject> typeErrorObj =
63 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(typeErrorFunc), typeErrorFunc);
64 JSHandle<JSObject> rangeErrorObj =
65 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(rangeErrorFunc), rangeErrorFunc);
66
67 EcmaRuntimeCallInfo* argv = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
68 argv->SetFunction(JSTaggedValue::Undefined());
69 argv->SetThis(JSTaggedValue(*errorObj));
70 auto prev = TestHelper::SetupFrame(thread, argv);
71 JSHandle<JSTaggedValue> error(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::ERROR));
72 TestHelper::TearDownFrame(thread, prev);
73
74 argv->SetThis(JSTaggedValue(*evalErrorObj));
75 prev = TestHelper::SetupFrame(thread, argv);
76 JSHandle<JSTaggedValue> evalError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::EVAL_ERROR));
77 TestHelper::TearDownFrame(thread, prev);
78
79 argv->SetThis(JSTaggedValue(*typeErrorObj));
80 prev = TestHelper::SetupFrame(thread, argv);
81 JSHandle<JSTaggedValue> typeError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::TYPE_ERROR));
82 TestHelper::TearDownFrame(thread, prev);
83
84 argv->SetThis(JSTaggedValue(*rangeErrorObj));
85 prev = TestHelper::SetupFrame(thread, argv);
86 JSHandle<JSTaggedValue> rangeError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::RANGE_ERROR));
87 TestHelper::TearDownFrame(thread, prev);
88
89 EcmaStringAccessor errorStrAcc(JSHandle<EcmaString>::Cast(error));
90 EcmaStringAccessor evalErrorStrAcc(JSHandle<EcmaString>::Cast(evalError));
91 EcmaStringAccessor typeErrorStrAcc(JSHandle<EcmaString>::Cast(typeError));
92 EcmaStringAccessor rangeErrorStrAcc(JSHandle<EcmaString>::Cast(rangeError));
93 EXPECT_STREQ(errorStrAcc.ToCString().c_str(), "Error");
94 EXPECT_STREQ(evalErrorStrAcc.ToCString().c_str(), "EvalError");
95 EXPECT_STREQ(typeErrorStrAcc.ToCString().c_str(), "TypeError");
96 EXPECT_STREQ(rangeErrorStrAcc.ToCString().c_str(), "RangeError");
97 }
98
HWTEST_F_L0(ErrorHelperTest,ErrorCommonToString_002)99 HWTEST_F_L0(ErrorHelperTest, ErrorCommonToString_002)
100 {
101 auto factory = instance->GetFactory();
102 auto env = instance->GetGlobalEnv();
103 JSHandle<JSTaggedValue> uriErrorFunc = env->GetURIErrorFunction();
104 JSHandle<JSTaggedValue> oomErrorFunc = env->GetOOMErrorFunction();
105 JSHandle<JSTaggedValue> syntaxErrorFunc = env->GetSyntaxErrorFunction();
106 JSHandle<JSTaggedValue> referenceErrorFunc = env->GetReferenceErrorFunction();
107 JSHandle<JSTaggedValue> aggregateErrorFunc = env->GetAggregateErrorFunction();
108 JSHandle<JSObject> uriErrorObj =
109 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(uriErrorFunc), uriErrorFunc);
110 JSHandle<JSObject> oomErrorObj =
111 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(oomErrorFunc), oomErrorFunc);
112 JSHandle<JSObject> syntaxErrorObj =
113 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(syntaxErrorFunc), syntaxErrorFunc);
114 JSHandle<JSObject> referenceErrorObj =
115 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(referenceErrorFunc), referenceErrorFunc);
116 JSHandle<JSObject> aggregateErrorObj =
117 factory->NewJSObjectByConstructor(JSHandle<JSFunction>(aggregateErrorFunc), aggregateErrorFunc);
118
119 EcmaRuntimeCallInfo* argv = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4);
120 argv->SetFunction(JSTaggedValue::Undefined());
121 argv->SetThis(JSTaggedValue(*uriErrorObj));
122 auto prev = TestHelper::SetupFrame(thread, argv);
123 JSHandle<JSTaggedValue> uriError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::URI_ERROR));
124 TestHelper::TearDownFrame(thread, prev);
125
126 argv->SetThis(JSTaggedValue(*oomErrorObj));
127 prev = TestHelper::SetupFrame(thread, argv);
128 JSHandle<JSTaggedValue> oomError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::OOM_ERROR));
129 TestHelper::TearDownFrame(thread, prev);
130
131 argv->SetThis(JSTaggedValue(*syntaxErrorObj));
132 prev = TestHelper::SetupFrame(thread, argv);
133 JSHandle<JSTaggedValue> syntaxError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::SYNTAX_ERROR));
134 TestHelper::TearDownFrame(thread, prev);
135
136 argv->SetThis(JSTaggedValue(*referenceErrorObj));
137 prev = TestHelper::SetupFrame(thread, argv);
138 JSHandle<JSTaggedValue> referenceError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::REFERENCE_ERROR));
139 TestHelper::TearDownFrame(thread, prev);
140
141 argv->SetThis(JSTaggedValue(*aggregateErrorObj));
142 prev = TestHelper::SetupFrame(thread, argv);
143 JSHandle<JSTaggedValue> aggregateError(thread, ErrorHelper::ErrorCommonToString(argv, ErrorType::AGGREGATE_ERROR));
144 TestHelper::TearDownFrame(thread, prev);
145
146 EcmaStringAccessor uriErrorStrAcc(JSHandle<EcmaString>::Cast(uriError));
147 EcmaStringAccessor oomErrorStrAcc(JSHandle<EcmaString>::Cast(oomError));
148 EcmaStringAccessor syntaxErrorStrAcc(JSHandle<EcmaString>::Cast(syntaxError));
149 EcmaStringAccessor referenceErrorStrAcc(JSHandle<EcmaString>::Cast(referenceError));
150 EcmaStringAccessor aggregateErrorStrAcc(JSHandle<EcmaString>::Cast(aggregateError));
151 EXPECT_STREQ(uriErrorStrAcc.ToCString().c_str(), "URIError");
152 EXPECT_STREQ(oomErrorStrAcc.ToCString().c_str(), "OutOfMemoryError");
153 EXPECT_STREQ(syntaxErrorStrAcc.ToCString().c_str(), "SyntaxError");
154 EXPECT_STREQ(referenceErrorStrAcc.ToCString().c_str(), "ReferenceError");
155 EXPECT_STREQ(aggregateErrorStrAcc.ToCString().c_str(), "AggregateError");
156 }
157
HWTEST_F_L0(ErrorHelperTest,ErrorCommonConstructor_001)158 HWTEST_F_L0(ErrorHelperTest, ErrorCommonConstructor_001)
159 {
160 auto factory = instance->GetFactory();
161 auto env = instance->GetGlobalEnv();
162 JSHandle<JSTaggedValue> msgKey = thread->GlobalConstants()->GetHandledMessageString();
163 JSHandle<JSTaggedValue> nameKey = thread->GlobalConstants()->GetHandledNameString();
164
165 JSHandle<JSFunction> error(env->GetErrorFunction());
166 JSHandle<JSFunction> evalError(env->GetEvalErrorFunction());
167 JSHandle<JSFunction> typeError(env->GetTypeErrorFunction());
168
169 JSHandle<JSTaggedValue> errorMsg(factory->NewFromASCII("You have an Error!"));
170 EcmaRuntimeCallInfo *argv1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6);
171 argv1->SetFunction(error.GetTaggedValue());
172 argv1->SetThis(JSTaggedValue(*error));
173 argv1->SetCallArg(0, errorMsg.GetTaggedValue());
174 auto prev1 = TestHelper::SetupFrame(thread, argv1);
175 JSHandle<JSTaggedValue> errorResult(thread, ErrorHelper::ErrorCommonConstructor(argv1, ErrorType::ERROR));
176 TestHelper::TearDownFrame(thread, prev1);
177 JSHandle<JSTaggedValue> errorMsgValue(JSObject::GetProperty(thread, errorResult, msgKey).GetValue());
178 JSHandle<JSTaggedValue> errorNameValue(JSObject::GetProperty(thread, errorResult, nameKey).GetValue());
179 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(errorMsgValue)).ToCString().c_str(),
180 "You have an Error!");
181 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(errorNameValue)).ToCString().c_str(), "Error");
182
183 JSHandle<JSTaggedValue> evalErrorMsg(factory->NewFromASCII("You have an eval error!"));
184 EcmaRuntimeCallInfo *argv2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*evalError), 6);
185 argv2->SetFunction(evalError.GetTaggedValue());
186 argv2->SetThis(JSTaggedValue(*evalError));
187 argv2->SetCallArg(0, evalErrorMsg.GetTaggedValue());
188 auto prev2 = TestHelper::SetupFrame(thread, argv2);
189 JSHandle<JSTaggedValue> evalErrorResult(thread, ErrorHelper::ErrorCommonConstructor(argv2, ErrorType::EVAL_ERROR));
190 TestHelper::TearDownFrame(thread, prev2);
191 JSHandle<JSTaggedValue> evalMsgValue(JSObject::GetProperty(thread, evalErrorResult, msgKey).GetValue());
192 JSHandle<JSTaggedValue> evalNameValue(JSObject::GetProperty(thread, evalErrorResult, nameKey).GetValue());
193 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(evalMsgValue)).ToCString().c_str(),
194 "You have an eval error!");
195 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(evalNameValue)).ToCString().c_str(), "EvalError");
196
197 JSHandle<JSTaggedValue> typeErrorMsg(factory->NewFromASCII("You have a type error!"));
198 EcmaRuntimeCallInfo *argv3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*typeError), 6);
199 argv3->SetFunction(typeError.GetTaggedValue());
200 argv3->SetThis(JSTaggedValue(*typeError));
201 argv3->SetCallArg(0, typeErrorMsg.GetTaggedValue());
202 auto prev3 = TestHelper::SetupFrame(thread, argv3);
203 JSHandle<JSTaggedValue> typeErrorResult(thread, ErrorHelper::ErrorCommonConstructor(argv3, ErrorType::TYPE_ERROR));
204 TestHelper::TearDownFrame(thread, prev3);
205 JSHandle<JSTaggedValue> typeMsgValue(JSObject::GetProperty(thread, typeErrorResult, msgKey).GetValue());
206 JSHandle<JSTaggedValue> typeNameValue(JSObject::GetProperty(thread, typeErrorResult, nameKey).GetValue());
207 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(typeMsgValue)).ToCString().c_str(),
208 "You have a type error!");
209 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(typeNameValue)).ToCString().c_str(), "TypeError");
210 }
211
HWTEST_F_L0(ErrorHelperTest,ErrorCommonConstructor_002)212 HWTEST_F_L0(ErrorHelperTest, ErrorCommonConstructor_002)
213 {
214 auto factory = instance->GetFactory();
215 auto env = instance->GetGlobalEnv();
216 JSHandle<JSTaggedValue> msgKey = thread->GlobalConstants()->GetHandledMessageString();
217 JSHandle<JSTaggedValue> nameKey = thread->GlobalConstants()->GetHandledNameString();
218
219 JSHandle<JSFunction> rangeError(env->GetRangeErrorFunction());
220 JSHandle<JSFunction> uriError(env->GetURIErrorFunction());
221 JSHandle<JSFunction> oomError(env->GetOOMErrorFunction());
222
223 JSHandle<JSTaggedValue> rangeErrorMsg(factory->NewFromASCII("You have an range error!"));
224 EcmaRuntimeCallInfo *argv1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*rangeError), 6);
225 argv1->SetFunction(rangeError.GetTaggedValue());
226 argv1->SetThis(JSTaggedValue(*rangeError));
227 argv1->SetCallArg(0, rangeErrorMsg.GetTaggedValue());
228 auto prev1 = TestHelper::SetupFrame(thread, argv1);
229 JSHandle<JSTaggedValue> rangeErrorResult(thread,
230 ErrorHelper::ErrorCommonConstructor(argv1, ErrorType::RANGE_ERROR));
231 TestHelper::TearDownFrame(thread, prev1);
232 JSHandle<JSTaggedValue> rangeMsgValue(JSObject::GetProperty(thread, rangeErrorResult, msgKey).GetValue());
233 JSHandle<JSTaggedValue> rangeNameValue(JSObject::GetProperty(thread, rangeErrorResult, nameKey).GetValue());
234 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(rangeMsgValue)).ToCString().c_str(),
235 "You have an range error!");
236 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(rangeNameValue)).ToCString().c_str(), "RangeError");
237
238 JSHandle<JSTaggedValue> uriErrorMsg(factory->NewFromASCII("You have an uri error!"));
239 EcmaRuntimeCallInfo *argv2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*uriError), 6);
240 argv2->SetFunction(uriError.GetTaggedValue());
241 argv2->SetThis(JSTaggedValue(*uriError));
242 argv2->SetCallArg(0, uriErrorMsg.GetTaggedValue());
243 auto prev2 = TestHelper::SetupFrame(thread, argv2);
244 JSHandle<JSTaggedValue> uriErrorResult(thread, ErrorHelper::ErrorCommonConstructor(argv2, ErrorType::URI_ERROR));
245 TestHelper::TearDownFrame(thread, prev2);
246 JSHandle<JSTaggedValue> uriMsgValue(JSObject::GetProperty(thread, uriErrorResult, msgKey).GetValue());
247 JSHandle<JSTaggedValue> uriNameValue(JSObject::GetProperty(thread, uriErrorResult, nameKey).GetValue());
248 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(uriMsgValue)).ToCString().c_str(),
249 "You have an uri error!");
250 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(uriNameValue)).ToCString().c_str(), "URIError");
251
252 JSHandle<JSTaggedValue> oomErrorMsg(factory->NewFromASCII("You have an out of memory error!"));
253 EcmaRuntimeCallInfo *argv3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*oomError), 6);
254 argv3->SetFunction(oomError.GetTaggedValue());
255 argv3->SetThis(JSTaggedValue(*oomError));
256 argv3->SetCallArg(0, oomErrorMsg.GetTaggedValue());
257 auto prev3 = TestHelper::SetupFrame(thread, argv3);
258 JSHandle<JSTaggedValue> oomErrorResult(thread, ErrorHelper::ErrorCommonConstructor(argv3, ErrorType::OOM_ERROR));
259 TestHelper::TearDownFrame(thread, prev3);
260 JSHandle<JSTaggedValue> oomMsgValue(JSObject::GetProperty(thread, oomErrorResult, msgKey).GetValue());
261 JSHandle<JSTaggedValue> oomNameValue(JSObject::GetProperty(thread, oomErrorResult, nameKey).GetValue());
262 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(oomMsgValue)).ToCString().c_str(),
263 "You have an out of memory error!");
264 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(oomNameValue)).ToCString().c_str(), "OutOfMemoryError");
265 }
266
HWTEST_F_L0(ErrorHelperTest,ErrorCommonConstructor_003)267 HWTEST_F_L0(ErrorHelperTest, ErrorCommonConstructor_003)
268 {
269 auto factory = instance->GetFactory();
270 auto env = instance->GetGlobalEnv();
271 JSHandle<JSTaggedValue> msgKey = thread->GlobalConstants()->GetHandledMessageString();
272 JSHandle<JSTaggedValue> nameKey = thread->GlobalConstants()->GetHandledNameString();
273
274 JSHandle<JSFunction> syntaxError(env->GetSyntaxErrorFunction());
275 JSHandle<JSFunction> referenceError(env->GetReferenceErrorFunction());
276 JSHandle<JSFunction> aggregateError(env->GetAggregateErrorFunction());
277
278 JSHandle<JSTaggedValue> syntaxErrorMsg(factory->NewFromASCII("You have an syntax error!"));
279 EcmaRuntimeCallInfo *argv1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*syntaxError), 6);
280 argv1->SetFunction(syntaxError.GetTaggedValue());
281 argv1->SetThis(JSTaggedValue(*syntaxError));
282 argv1->SetCallArg(0, syntaxErrorMsg.GetTaggedValue());
283 auto prev1 = TestHelper::SetupFrame(thread, argv1);
284 JSHandle<JSTaggedValue> syntaxErrorResult(thread,
285 ErrorHelper::ErrorCommonConstructor(argv1, ErrorType::SYNTAX_ERROR));
286 TestHelper::TearDownFrame(thread, prev1);
287 JSHandle<JSTaggedValue> syntaxMsgValue(JSObject::GetProperty(thread, syntaxErrorResult, msgKey).GetValue());
288 JSHandle<JSTaggedValue> syntaxNameValue(JSObject::GetProperty(thread, syntaxErrorResult, nameKey).GetValue());
289 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(syntaxMsgValue)).ToCString().c_str(),
290 "You have an syntax error!");
291 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(syntaxNameValue)).ToCString().c_str(), "SyntaxError");
292
293 JSHandle<JSTaggedValue> referenceErrorMsg(factory->NewFromASCII("You have an reference error!"));
294 EcmaRuntimeCallInfo *argv2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*referenceError), 6);
295 argv2->SetFunction(referenceError.GetTaggedValue());
296 argv2->SetThis(JSTaggedValue(*referenceError));
297 argv2->SetCallArg(0, referenceErrorMsg.GetTaggedValue());
298 auto prev2 = TestHelper::SetupFrame(thread, argv2);
299 JSHandle<JSTaggedValue> referenceErrorResult(thread,
300 ErrorHelper::ErrorCommonConstructor(argv2, ErrorType::REFERENCE_ERROR));
301 TestHelper::TearDownFrame(thread, prev2);
302 JSHandle<JSTaggedValue> referenceMsgValue(JSObject::GetProperty(thread, referenceErrorResult, msgKey).GetValue());
303 JSHandle<JSTaggedValue> referenceNameValue(
304 JSObject::GetProperty(thread, referenceErrorResult, nameKey).GetValue());
305 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(referenceMsgValue)).ToCString().c_str(),
306 "You have an reference error!");
307 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(referenceNameValue)).ToCString().c_str(),
308 "ReferenceError");
309
310 JSHandle<JSTaggedValue> aggregateErrorMsg(factory->NewFromASCII("You have an aggregate error!"));
311 EcmaRuntimeCallInfo *argv3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*aggregateError), 6);
312 argv3->SetFunction(aggregateError.GetTaggedValue());
313 argv3->SetThis(JSTaggedValue(*aggregateError));
314 argv3->SetCallArg(0, aggregateErrorMsg.GetTaggedValue());
315 auto prev3 = TestHelper::SetupFrame(thread, argv3);
316 JSHandle<JSTaggedValue> aggregateErrorResult(thread,
317 ErrorHelper::ErrorCommonConstructor(argv3, ErrorType::AGGREGATE_ERROR));
318 TestHelper::TearDownFrame(thread, prev3);
319 JSHandle<JSTaggedValue> aggregateMsgValue(JSObject::GetProperty(thread, aggregateErrorResult, msgKey).GetValue());
320 JSHandle<JSTaggedValue> aggregateNameValue(
321 JSObject::GetProperty(thread, aggregateErrorResult, nameKey).GetValue());
322 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(aggregateMsgValue)).ToCString().c_str(),
323 "You have an aggregate error!");
324 EXPECT_STREQ(EcmaStringAccessor(JSHandle<EcmaString>::Cast(aggregateNameValue)).ToCString().c_str(),
325 "AggregateError");
326 }
327 } // namespace panda::test
328