aboutsummaryrefslogtreecommitdiff
path: root/lldb/packages/Python/lldbsuite/test/lldbtest.py
diff options
context:
space:
mode:
authorDavid Peixotto <peix@meta.com>2025-07-15 12:44:00 -0700
committerGitHub <noreply@github.com>2025-07-15 12:44:00 -0700
commitfccae859bc949ba390184614e07234267a734b86 (patch)
treec73a538cce7754b35134d044ebbbd591fa6ff5c9 /lldb/packages/Python/lldbsuite/test/lldbtest.py
parentd67d91a9906366585162cebf292f923a3f28c8a6 (diff)
downloadllvm-fccae859bc949ba390184614e07234267a734b86.zip
llvm-fccae859bc949ba390184614e07234267a734b86.tar.gz
llvm-fccae859bc949ba390184614e07234267a734b86.tar.bz2
[lldb] Add completions for plugin list/enable/disable (#147775)
This commit adds completion support for the plugin commands. It will try to complete partial namespaces to the full namespace string. If the completion input is already a full namespace string then it will add all the matching plugins in that namespace as completions. This lets the user complete to the namespace first and then tab-complete to the next level if desired. ``` (lldb) plugin list a<tab> Available completions: abi architecture (lldb) plugin list ab<tab> (lldb) plugin list abi<tab> (lldb) plugin list abi.<tab> Available completions: abi.SysV-arm64 abi.ABIMacOSX_arm64 abi.SysV-arm ... ```
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/lldbtest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/lldbtest.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index a4ff96e..63fadb5 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2268,7 +2268,7 @@ class TestBase(Base, metaclass=LLDBTestCaseFactory):
completions, list(match_strings)[1:], "List of returned completion is wrong"
)
- def completions_contain(self, command, completions):
+ def completions_contain(self, command, completions, match=True):
"""Checks that the completions for the given command contain the given
list of completions."""
interp = self.dbg.GetCommandInterpreter()
@@ -2276,9 +2276,16 @@ class TestBase(Base, metaclass=LLDBTestCaseFactory):
interp.HandleCompletion(command, len(command), 0, -1, match_strings)
for completion in completions:
# match_strings is a 1-indexed list, so we have to slice...
- self.assertIn(
- completion, list(match_strings)[1:], "Couldn't find expected completion"
- )
+ if match:
+ self.assertIn(
+ completion,
+ list(match_strings)[1:],
+ "Couldn't find expected completion",
+ )
+ else:
+ self.assertNotIn(
+ completion, list(match_strings)[1:], "Found unexpected completion"
+ )
def filecheck(
self, command, check_file, filecheck_options="", expect_cmd_failure=False