diff options
Diffstat (limited to 'clang/unittests/Basic/FileManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index 9f051976ca0..14c7879a091 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/unittests/Basic/FileManagerTest.cpp @@ -346,4 +346,18 @@ TEST_F(FileManagerTest, getVirtualFileFillsRealPathName) { EXPECT_EQ(file->tryGetRealPathName(), ExpectedResult); } +TEST_F(FileManagerTest, getFileDontOpenRealPath) { + auto statCache = llvm::make_unique<FakeStatCache>(); + statCache->InjectDirectory("/tmp/abc", 42); + SmallString<64> Path("/tmp/abc/foo.cpp"); + statCache->InjectFile(Path.str().str().c_str(), 43); + manager.setStatCache(std::move(statCache)); + + const FileEntry *file = manager.getFile(Path, /*openFile=*/false); + + ASSERT_TRUE(file != nullptr); + + ASSERT_EQ(file->tryGetRealPathName(), Path); +} + } // anonymous namespace |