winfsp unit tests and fixes
This commit is contained in:
parent
fd16a55745
commit
ec2ff87ac7
@ -103,6 +103,35 @@ TYPED_TEST(winfsp_test, info_can_get_standard_info) {
|
|||||||
|
|
||||||
::CloseHandle(handle);
|
::CloseHandle(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TYPED_TEST(winfsp_test, info_can_get_file_name_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);
|
||||||
|
|
||||||
|
std::array<std::uint8_t, sizeof(FILE_NAME_INFO) + MAX_PATH> name_info{};
|
||||||
|
EXPECT_TRUE(
|
||||||
|
::GetFileInformationByHandleEx(handle, FileNameInfo, name_info.data(),
|
||||||
|
static_cast<DWORD>(name_info.size())));
|
||||||
|
|
||||||
|
auto *info = reinterpret_cast<FILE_NAME_INFO *>(name_info.data());
|
||||||
|
auto expected_name{
|
||||||
|
std::string{"\\repertory\\"} + std::string::to_lower(this->mount_location).at(0U)) +
|
||||||
|
"\\test_file_2",
|
||||||
|
};
|
||||||
|
|
||||||
|
EXPECT_EQ(info->FileNameLength,
|
||||||
|
static_cast<DWORD>(expected_name.size() * 2U));
|
||||||
|
EXPECT_STREQ(expected_name.c_str(),
|
||||||
|
utils::string::to_utf8(info->FileName).c_str());
|
||||||
|
|
||||||
|
::CloseHandle(handle);
|
||||||
|
}
|
||||||
} // namespace repertory
|
} // namespace repertory
|
||||||
|
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user