[Lldb-commits] [PATCH] D48665: Added test case for: r334978 - Fixed file completion for paths that start with '~'

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 28 12:40:53 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL335905:  Added test case for: r334978 - Fixed file completion for paths that start with… (authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D48665?vs=153143&id=153370#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D48665

Files:
  lldb/trunk/unittests/Interpreter/TestCompletion.cpp


Index: lldb/trunk/unittests/Interpreter/TestCompletion.cpp
===================================================================
--- lldb/trunk/unittests/Interpreter/TestCompletion.cpp
+++ lldb/trunk/unittests/Interpreter/TestCompletion.cpp
@@ -51,6 +51,7 @@
   static SmallString<128> DirBar;
   static SmallString<128> DirBaz;
   static SmallString<128> DirTestFolder;
+  static SmallString<128> DirNested;
 
   static SmallString<128> FileAA;
   static SmallString<128> FileAB;
@@ -65,17 +66,17 @@
     llvm::sys::fs::current_path(OriginalWorkingDir);
 
     ASSERT_NO_ERROR(fs::createUniqueDirectory("FsCompletion", BaseDir));
-    const char *DirNames[] = {"foo", "fooa", "foob",       "fooc",
-                              "bar", "baz",  "test_folder"};
+    const char *DirNames[] = {"foo", "fooa", "foob",        "fooc",
+                              "bar", "baz",  "test_folder", "foo/nested"};
     const char *FileNames[] = {"aa1234.tmp",  "ab1234.tmp",  "ac1234.tmp",
                                "foo1234.tmp", "bar1234.tmp", "baz1234.tmp"};
-    SmallString<128> *Dirs[] = {&DirFoo, &DirFooA, &DirFooB,      &DirFooC,
-                                &DirBar, &DirBaz,  &DirTestFolder};
+    SmallString<128> *Dirs[] = {&DirFoo, &DirFooA, &DirFooB,       &DirFooC,
+                                &DirBar, &DirBaz,  &DirTestFolder, &DirNested};
     for (auto Dir : llvm::zip(DirNames, Dirs)) {
       auto &Path = *std::get<1>(Dir);
       Path = BaseDir;
       path::append(Path, std::get<0>(Dir));
-      ASSERT_NO_ERROR(fs::create_directory(Path));
+      ASSERT_NO_ERROR(fs::create_directories(Path));
     }
 
     SmallString<128> *Files[] = {&FileAA,  &FileAB,  &FileAC,
@@ -146,6 +147,7 @@
 SmallString<128> CompletionTest::DirBar;
 SmallString<128> CompletionTest::DirBaz;
 SmallString<128> CompletionTest::DirTestFolder;
+SmallString<128> CompletionTest::DirNested;
 
 SmallString<128> CompletionTest::FileAA;
 SmallString<128> CompletionTest::FileAB;
@@ -280,6 +282,20 @@
   EXPECT_TRUE(ContainsExactString(
       Twine("~/test_folder") + path::get_separator(), Results));
 
+  // Check that we can complete directories in nested paths
+  Count = CommandCompletions::DiskDirectories("~/foo/", Results, Resolver);
+  ASSERT_EQ(1u, Count);
+  ASSERT_EQ(Count, Results.GetSize());
+  EXPECT_TRUE(ContainsExactString(Twine("~/foo") + path::get_separator() +
+                                      "nested" + path::get_separator(),
+                                  Results));
+  Count = CommandCompletions::DiskDirectories("~/foo/nes", Results, Resolver);
+  ASSERT_EQ(1u, Count);
+  ASSERT_EQ(Count, Results.GetSize());
+  EXPECT_TRUE(ContainsExactString(Twine("~/foo") + path::get_separator() +
+                                      "nested" + path::get_separator(),
+                                  Results));
+
   // With ~username syntax it should return one match if there is an exact
   // match.
   // It shouldn't translate to the actual directory, it should keep the form the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48665.153370.patch
Type: text/x-patch
Size: 3018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180628/b7d98705/attachment.bin>


More information about the lldb-commits mailing list