From e03c7733a5ba3e9a2aeb4c1241b9d34e47fa923c Mon Sep 17 00:00:00 2001 From: tuxiaohang Date: Tue, 15 Oct 2024 07:29:08 +0000 Subject: [PATCH] =?UTF-8?q?UT=E7=94=A8=E4=BE=8B=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E7=94=B3=E8=AF=B7=E7=9A=84=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAX8RI Signed-off-by: tuxiaohang Change-Id: I34b91cf1f23e5352f0cb8d41b51e7bdf9aff4655 --- ecmascript/napi/test/jsnapi_second_tests.cpp | 25 +++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ecmascript/napi/test/jsnapi_second_tests.cpp b/ecmascript/napi/test/jsnapi_second_tests.cpp index a4c393683d..8e41d32679 100644 --- a/ecmascript/napi/test/jsnapi_second_tests.cpp +++ b/ecmascript/napi/test/jsnapi_second_tests.cpp @@ -1205,6 +1205,8 @@ HWTEST_F_L0(JSNApiTests, GetValueDouble) ASSERT_FALSE(nativeValue->GetValueDouble(isNumber)); isNumber = false; ASSERT_FALSE(nativeValue->GetValueDouble(isNumber)); + + delete nativeValue; } @@ -1223,6 +1225,8 @@ HWTEST_F_L0(JSNApiTests, GetValueInt32) ASSERT_FALSE(nativeValue->GetValueInt32(isNumber)); isNumber = false; ASSERT_FALSE(nativeValue->GetValueInt32(isNumber)); + + delete nativeValue; } @@ -1241,6 +1245,8 @@ HWTEST_F_L0(JSNApiTests, GetValueUint32) ASSERT_FALSE(nativeValue->GetValueUint32(isNumber)); isNumber = false; ASSERT_FALSE(nativeValue->GetValueUint32(isNumber)); + + delete nativeValue; } @@ -1259,6 +1265,8 @@ HWTEST_F_L0(JSNApiTests, GetValueInt64) ASSERT_FALSE(nativeValue->GetValueInt64(isNumber)); isNumber = false; ASSERT_FALSE(nativeValue->GetValueInt64(isNumber)); + + delete nativeValue; } @@ -1277,6 +1285,8 @@ HWTEST_F_L0(JSNApiTests, GetValueBool) ASSERT_FALSE(nativeValue->GetValueBool(isNumber)); isNumber = false; ASSERT_FALSE(nativeValue->GetValueBool(isNumber)); + + delete nativeValue; } @@ -1635,9 +1645,12 @@ HWTEST_F_L0(JSNApiTests, PromiseRejectInfo) Local promise(toStringPromise); Local toStringReason = StringRef::NewFromUtf8(vm_, TEST_NUM1); Local reason(toStringReason); - void *data = static_cast(new std::string(TEST_VALUE)); + std::string* str = new std::string(TEST_VALUE); + void *data = static_cast(str); PromiseRejectInfo promisereject(promise, reason, PromiseRejectInfo::PROMISE_REJECTION_EVENT::REJECT, data); EXPECT_EQ(promisereject.GetOperation(), PromiseRejectInfo::PROMISE_REJECTION_EVENT::REJECT); + + delete str; } /** @@ -1785,6 +1798,8 @@ HWTEST_F_L0(JSNApiTests, JSNApi_StartDebugger) option->libraryPath = ARK_DEBUGGER_LIB_PATH; EXPECT_FALSE(JSNApi::StartDebugger(vm_, *option)); + + delete option; } /** @@ -1804,6 +1819,8 @@ HWTEST_F_L0(JSNApiTests, JSNApi_StartDebuggerForOldProcess) option->libraryPath = ARK_DEBUGGER_LIB_PATH; EXPECT_FALSE(JSNApi::StartDebuggerForOldProcess(vm_, *option, 1, debuggerPostTask)); + + delete option; } /** @@ -1824,6 +1841,8 @@ HWTEST_F_L0(JSNApiTests, JSNApi_StartDebuggerForSocketPair) ecmascript::tooling::JsDebuggerManager *jsDebuggerManager = new ecmascript::tooling::JsDebuggerManager(vm_); ecmascript::tooling::JsDebuggerManager::AddJsDebuggerManager(tid, jsDebuggerManager); EXPECT_FALSE(JSNApi::StartDebuggerForSocketPair(tid, socketfd)); + + delete jsDebuggerManager; } /** @@ -1850,6 +1869,8 @@ HWTEST_F_L0(JSNApiTests, JSNApi_NotifyDebugMode) option->libraryPath = ARK_DEBUGGER_LIB_PATH; EXPECT_FALSE(JSNApi::NotifyDebugMode(tid, vm_, *option, instanceId, debuggerPostTask, debugApp)); + + delete option; } /** @@ -1872,6 +1893,8 @@ HWTEST_F_L0(JSNApiTests, JSNApi_StoreDebugInfo) option->libraryPath = ARK_DEBUGGER_LIB_PATH; EXPECT_FALSE(JSNApi::StoreDebugInfo(tid, vm_, *option, debuggerPostTask, debugApp)); + + delete option; } /**