diff options
Diffstat (limited to 'lldb/unittests/Host/FileSystemTest.cpp')
| -rw-r--r-- | lldb/unittests/Host/FileSystemTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lldb/unittests/Host/FileSystemTest.cpp b/lldb/unittests/Host/FileSystemTest.cpp index 7fea3b3a529..31184d9ad53 100644 --- a/lldb/unittests/Host/FileSystemTest.cpp +++ b/lldb/unittests/Host/FileSystemTest.cpp @@ -288,3 +288,18 @@ TEST(FileSystemTest, EnumerateDirectory) { EXPECT_THAT(visited, testing::UnorderedElementsAre("/foo", "/bar", "/baz", "/qux")); } + +TEST(FileSystemTest, OpenErrno) { +#ifdef _WIN32 + FileSpec spec("C:\\FILE\\THAT\\DOES\\NOT\\EXIST.TXT"); +#else + FileSpec spec("/file/that/does/not/exist.txt"); +#endif + FileSystem fs; + auto file = fs.Open(spec, File::eOpenOptionRead, 0, true); + ASSERT_FALSE(file); + std::error_code code = errorToErrorCode(file.takeError()); + EXPECT_EQ(code.category(), std::system_category()); + EXPECT_EQ(code.value(), ENOENT); +} + |

