diff options
author | Jan Korous <jkorous@apple.com> | 2019-02-18 23:12:29 +0000 |
---|---|---|
committer | Jan Korous <jkorous@apple.com> | 2019-02-18 23:12:29 +0000 |
commit | 1dbc72185a0d86d0c7f6f95a40aefba560d3196e (patch) | |
tree | 0aa1083512912cfd6da7f16f745c67805f5735af /clang/unittests/Basic/FileManagerTest.cpp | |
parent | 4cabf6d3b52b9f6648c0c3e09ac87483e6be76cc (diff) | |
download | bcm5719-llvm-1dbc72185a0d86d0c7f6f95a40aefba560d3196e.tar.gz bcm5719-llvm-1dbc72185a0d86d0c7f6f95a40aefba560d3196e.zip |
[clang][test] Fix FileManagerTest.getFileDontOpenRealPath for Windows
llvm-svn: 354296
Diffstat (limited to 'clang/unittests/Basic/FileManagerTest.cpp')
-rw-r--r-- | clang/unittests/Basic/FileManagerTest.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/unittests/Basic/FileManagerTest.cpp b/clang/unittests/Basic/FileManagerTest.cpp index 5262dad2bce..866859a521e 100644 --- a/clang/unittests/Basic/FileManagerTest.cpp +++ b/clang/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 |