From fd16a55745d514bc74ca012ba270cbf9331d56c4 Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 1 Nov 2024 09:41:50 -0500 Subject: [PATCH] winfsp unit tests and fixes --- .../src/winfsp_drive_info_test.cpp | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/repertory/repertory_test/src/winfsp_drive_info_test.cpp b/repertory/repertory_test/src/winfsp_drive_info_test.cpp index ed6469fb..0bd12fdb 100644 --- a/repertory/repertory_test/src/winfsp_drive_info_test.cpp +++ b/repertory/repertory_test/src/winfsp_drive_info_test.cpp @@ -81,6 +81,28 @@ TYPED_TEST(winfsp_test, info_can_get_basic_info) { ::CloseHandle(handle); } + +TYPED_TEST(winfsp_test, info_can_get_standard_info) { + auto file_path{ + utils::path::combine(this->mount_location, {"test_file_2"}), + }; + auto handle = + ::CreateFileA(file_path.c_str(), GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, 0, CREATE_NEW, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, 0); + ASSERT_NE(INVALID_HANDLE_VALUE, handle); + + FILE_STANDARD_INFO std_info{}; + EXPECT_TRUE(::GetFileInformationByHandleEx(handle, FileStandardInfo, + &std_info, sizeof std_info)); + EXPECT_EQ(0, std_info.AllocationSize.QuadPart); + EXPECT_EQ(0, std_info.EndOfFile.QuadPart); + EXPECT_EQ(1, std_info.NumberOfLinks); + EXPECT_FALSE(std_info.DeletePending); + EXPECT_FALSE(std_info.Directory); + + ::CloseHandle(handle); +} } // namespace repertory #endif // defined(_WIN32)