summaryrefslogtreecommitdiff
path: root/unittests/Basic/FileManagerTest.cpp
diff options
context:
space:
mode:
authorJan Korous <jkorous@apple.com>2019-02-18 23:12:29 +0000
committerJan Korous <jkorous@apple.com>2019-02-18 23:12:29 +0000
commitb492883ea31e2046d5725126318911465bc1374f (patch)
treee64349354228e29b137c4c4e9bb51fa10b21851b /unittests/Basic/FileManagerTest.cpp
parent555a67069d590cee0b387321da765b7ebd6f11c4 (diff)
downloadclang-b492883ea31e2046d5725126318911465bc1374f.tar.gz
[clang][test] Fix FileManagerTest.getFileDontOpenRealPath for Windows
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@354296 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Basic/FileManagerTest.cpp')
-rw-r--r--unittests/Basic/FileManagerTest.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/unittests/Basic/FileManagerTest.cpp b/unittests/Basic/FileManagerTest.cpp
index 5262dad2bc..866859a521 100644
--- a/unittests/Basic/FileManagerTest.cpp
+++ b/unittests/Basic/FileManagerTest.cpp
@@ -362,17 +362,21 @@ TEST_F(FileManagerTest, getFileDontOpenRealPath) {
FileSystemOptions Opts;
FileManager Manager(Opts, FS);
+ // Inject fake files into the file system.
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));
+ statCache->InjectDirectory("/tmp", 42);
+ statCache->InjectFile("/tmp/test", 43);
- const FileEntry *file = manager.getFile(Path, /*openFile=*/false);
+ Manager.setStatCache(std::move(statCache));
+ // Check for real path.
+ const FileEntry *file = Manager.getFile("/tmp/test", /*OpenFile=*/false);
ASSERT_TRUE(file != nullptr);
+ ASSERT_TRUE(file->isValid());
+ SmallString<64> ExpectedResult = CustomWorkingDir;
- ASSERT_EQ(file->tryGetRealPathName(), Path);
+ llvm::sys::path::append(ExpectedResult, "tmp", "test");
+ EXPECT_EQ(file->tryGetRealPathName(), ExpectedResult);
}
} // anonymous namespace