summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Basic/VirtualFileSystemTest.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-10-06 14:45:16 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-10-06 14:45:16 +0000
commit1b8dbe3738c78240ffdbd67a556d464309b8f504 (patch)
tree658f53aee31cb86c725114b44fa7e5f8af1df64d /clang/unittests/Basic/VirtualFileSystemTest.cpp
parentcac8fc2329b8ee623c42944823f88b401a747ada (diff)
downloadbcm5719-llvm-1b8dbe3738c78240ffdbd67a556d464309b8f504.tar.gz
bcm5719-llvm-1b8dbe3738c78240ffdbd67a556d464309b8f504.zip
[VFS] Put the incoming name in the file status to make InMemoryFS behave more like a real FS.
llvm-svn: 249409
Diffstat (limited to 'clang/unittests/Basic/VirtualFileSystemTest.cpp')
-rw-r--r--clang/unittests/Basic/VirtualFileSystemTest.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/unittests/Basic/VirtualFileSystemTest.cpp b/clang/unittests/Basic/VirtualFileSystemTest.cpp
index 0b767dd0c8d..005737e9de3 100644
--- a/clang/unittests/Basic/VirtualFileSystemTest.cpp
+++ b/clang/unittests/Basic/VirtualFileSystemTest.cpp
@@ -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 {
OpenPOWER on IntegriCloud