From a545cb63d11b49a3179a3aa7bc5b10ce52179891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E9=91=AB?= Date: Mon, 30 Jun 2025 11:00:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=93=9D=E9=BB=84=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 周鑫 --- interfaces/kits/js/src/mod_fs/fs_utils.cpp | 3 +-- interfaces/test/unittest/js/BUILD.gn | 8 ++++++++ .../js/mod_fs/class_stat/fs_stat_mock_test.cpp | 10 +++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/fs_utils.cpp b/interfaces/kits/js/src/mod_fs/fs_utils.cpp index ef2e3963b..d8331b21b 100644 --- a/interfaces/kits/js/src/mod_fs/fs_utils.cpp +++ b/interfaces/kits/js/src/mod_fs/fs_utils.cpp @@ -36,8 +36,7 @@ tuple FsUtils::GetActualLen(size_t bufLen, size_t bufOff, const op if (length.has_value()) { int64_t opLength = length.value(); if (opLength < 0 || static_cast(opLength) > retLen) { - HILOGE("Invalid option.length: option.length (%{public}lld), bufLen (%{public}zu), bufOff (%{public}zu)", - opLength, bufLen, bufOff); + HILOGE("Invalid option.length: option.length=%{public}" PRId64 ", retLen=%{public}zu", opLength, retLen); return { false, 0 }; } retLen = static_cast(opLength); diff --git a/interfaces/test/unittest/js/BUILD.gn b/interfaces/test/unittest/js/BUILD.gn index dd2a44757..31b84da70 100644 --- a/interfaces/test/unittest/js/BUILD.gn +++ b/interfaces/test/unittest/js/BUILD.gn @@ -67,6 +67,8 @@ ohos_unittest("ani_file_fs_mock_test") { defines = [ "private=public", ] + + use_exceptions = true } ohos_unittest("ani_file_fs_test") { @@ -127,6 +129,8 @@ ohos_unittest("ani_file_fs_test") { defines = [ "private=public", ] + + use_exceptions = true } ohos_unittest("ani_file_hash_test") { @@ -156,6 +160,8 @@ ohos_unittest("ani_file_hash_test") { "googletest:gmock_main", "googletest:gtest_main", ] + + use_exceptions = true } ohos_unittest("ani_file_securitylabel_test") { @@ -183,4 +189,6 @@ ohos_unittest("ani_file_securitylabel_test") { "googletest:gmock_main", "googletest:gtest_main", ] + + use_exceptions = true } \ No newline at end of file diff --git a/interfaces/test/unittest/js/mod_fs/class_stat/fs_stat_mock_test.cpp b/interfaces/test/unittest/js/mod_fs/class_stat/fs_stat_mock_test.cpp index 98093ee64..ea2e168d5 100644 --- a/interfaces/test/unittest/js/mod_fs/class_stat/fs_stat_mock_test.cpp +++ b/interfaces/test/unittest/js/mod_fs/class_stat/fs_stat_mock_test.cpp @@ -13,13 +13,13 @@ * limitations under the License. */ -#include -#include - -#include "fs_stat_entity.h" #include "fs_stat.h" +#include "../properties/mock/system_mock.h" +#include "fs_stat_entity.h" #include "securec.h" -#include "system_mock.h" + +#include +#include namespace OHOS::FileManagement::ModuleFileIO::Test { using namespace testing; -- Gitee