[VFS] Put the incoming name in the file status to make InMemoryFS behave more like a real FS.

llvm-svn: 249409
This commit is contained in:
Benjamin Kramer
2015-10-06 14:45:16 +00:00
parent cac8fc2329
commit 1b8dbe3738
2 changed files with 14 additions and 1 deletions

View File

@@ -602,6 +602,19 @@ TEST_F(InMemoryFileSystemTest, DirectoryIteration) {
ASSERT_EQ(vfs::directory_iterator(), I);
}
TEST_F(InMemoryFileSystemTest, WorkingDirectory) {
FS.setCurrentWorkingDirectory("/b");
FS.addFile("c", 0, MemoryBuffer::getMemBuffer(""));
auto Stat = FS.status("/b/c");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
ASSERT_EQ("c", Stat->getName());
ASSERT_EQ("/b", *FS.getCurrentWorkingDirectory());
Stat = FS.status("c");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
}
// NOTE: in the tests below, we use '//root/' as our root directory, since it is
// a legal *absolute* path on Windows as well as *nix.
class VFSFromYAMLTest : public ::testing::Test {