mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Fix posix-test, take 3.
This commit is contained in:
parent
94daf27c9d
commit
b54d6e7124
@ -103,11 +103,11 @@ errno_t test::sopen_s(
|
|||||||
static LONGLONG max_file_size() { return std::numeric_limits<LONGLONG>::max(); }
|
static LONGLONG max_file_size() { return std::numeric_limits<LONGLONG>::max(); }
|
||||||
|
|
||||||
BOOL test::GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize) {
|
BOOL test::GetFileSizeEx(HANDLE hFile, PLARGE_INTEGER lpFileSize) {
|
||||||
BOOL result = ::GetFileSizeEx(hFile, lpFileSize);
|
|
||||||
if (fstat_sim == ERROR) {
|
if (fstat_sim == ERROR) {
|
||||||
SetLastError(ERROR_ACCESS_DENIED);
|
SetLastError(ERROR_ACCESS_DENIED);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
BOOL result = ::GetFileSizeEx(hFile, lpFileSize);
|
||||||
if (fstat_sim == MAX_SIZE)
|
if (fstat_sim == MAX_SIZE)
|
||||||
lpFileSize->QuadPart = max_file_size();
|
lpFileSize->QuadPart = max_file_size();
|
||||||
return result;
|
return result;
|
||||||
@ -255,7 +255,6 @@ TEST(FileTest, Size) {
|
|||||||
write_file("test", content);
|
write_file("test", content);
|
||||||
File f("test", File::RDONLY);
|
File f("test", File::RDONLY);
|
||||||
EXPECT_EQ(content.size(), f.size());
|
EXPECT_EQ(content.size(), f.size());
|
||||||
f.close();
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
fmt::Writer message;
|
fmt::Writer message;
|
||||||
fmt::internal::format_windows_error(
|
fmt::internal::format_windows_error(
|
||||||
@ -264,6 +263,7 @@ TEST(FileTest, Size) {
|
|||||||
EXPECT_THROW_MSG(f.size(), fmt::WindowsError, message.str());
|
EXPECT_THROW_MSG(f.size(), fmt::WindowsError, message.str());
|
||||||
fstat_sim = NONE;
|
fstat_sim = NONE;
|
||||||
#else
|
#else
|
||||||
|
f.close();
|
||||||
EXPECT_SYSTEM_ERROR(f.size(), EBADF, "cannot get file attributes");
|
EXPECT_SYSTEM_ERROR(f.size(), EBADF, "cannot get file attributes");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user