mirror of
https://github.com/google/googletest.git
synced 2025-12-06 16:57:00 +08:00
Print the error code when unable to create a temporary file on Windows
Help root cause a sporadic error seen when running gtest applications
This commit is contained in:
parent
f8d7d77c06
commit
08b0797178
@ -76,6 +76,7 @@ namespace {
|
||||
TEST(FactorialTest, Negative) {
|
||||
// This test is named "Negative", and belongs to the "FactorialTest"
|
||||
// test case.
|
||||
testing::internal::CaptureStdout();
|
||||
EXPECT_EQ(1, Factorial(-5));
|
||||
EXPECT_EQ(1, Factorial(-1));
|
||||
EXPECT_GT(Factorial(-10), 0);
|
||||
|
||||
@ -1042,7 +1042,7 @@ class CapturedStream {
|
||||
0, // Generate unique file name.
|
||||
temp_file_path);
|
||||
GTEST_CHECK_(success != 0)
|
||||
<< "Unable to create a temporary file in " << temp_dir_path;
|
||||
<< "Unable to create a temporary file in " << temp_dir_path << ". Error message: " << ::GetLastError();
|
||||
const int captured_fd = creat(temp_file_path, _S_IREAD | _S_IWRITE);
|
||||
GTEST_CHECK_(captured_fd != -1)
|
||||
<< "Unable to open temporary file " << temp_file_path;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user