[llvm] f2f7749 - [VFS] Extend virtual working directory test
    Jonas Devlieghere via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Dec 11 10:02:18 PST 2019
    
    
  
Author: Jonas Devlieghere
Date: 2019-12-11T09:50:41-08:00
New Revision: f2f774997357cc6690d8a2446140d0c4df83e828
URL: https://github.com/llvm/llvm-project/commit/f2f774997357cc6690d8a2446140d0c4df83e828
DIFF: https://github.com/llvm/llvm-project/commit/f2f774997357cc6690d8a2446140d0c4df83e828.diff
LOG: [VFS] Extend virtual working directory test
Extend the virtual working directory test with a few edge cases that are
not currently tested.
Added: 
    
Modified: 
    llvm/unittests/Support/VirtualFileSystemTest.cpp
Removed: 
    
################################################################################
diff  --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index 69e9ce80f79b..87547b29c671 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -2089,6 +2089,16 @@ TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthrough) {
       "                  'external-contents': '//root/foo/a'\n"
       "                }\n"
       "              ]\n"
+      "},\n"
+      "{\n"
+      "  'type': 'directory',\n"
+      "  'name': '//root/bar/baz',\n"
+      "  'contents': [ {\n"
+      "                  'type': 'file',\n"
+      "                  'name': 'a',\n"
+      "                  'external-contents': '//root/foo/a'\n"
+      "                }\n"
+      "              ]\n"
       "}\n"
       "]\n"
       "}",
@@ -2125,6 +2135,21 @@ TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthrough) {
   Status = FS->status("c");
   ASSERT_FALSE(Status.getError());
   EXPECT_TRUE(Status->exists());
+
+  Status = FS->status("./bar/baz/a");
+  ASSERT_FALSE(Status.getError());
+  EXPECT_TRUE(Status->exists());
+
+  EC = FS->setCurrentWorkingDirectory("//root/bar");
+  ASSERT_FALSE(EC);
+
+  Status = FS->status("./baz/a");
+  ASSERT_FALSE(Status.getError());
+  EXPECT_TRUE(Status->exists());
+
+  Status = FS->status("../bar/baz/a");
+  ASSERT_FALSE(Status.getError());
+  EXPECT_TRUE(Status->exists());
 }
 
 TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthroughInvalid) {
        
    
    
More information about the llvm-commits
mailing list