mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-11 01:56:06 +00:00

Instead of relying that three tabs show all completions, we should show all remaining completions which will always stop the mode where we show completions. Should fix this test on systems that somehow have more completions that our normal LLDB (as they would end up being stuck in the mode where we show completions). llvm-svn: 369293
62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
"""
|
|
Test completion in our IOHandlers.
|
|
"""
|
|
|
|
import lldb
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
class IOHandlerCompletionTest(TestBase):
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
NO_DEBUG_INFO_TESTCASE = True
|
|
|
|
def setUp(self):
|
|
TestBase.setUp(self)
|
|
|
|
def expect_string(self, string):
|
|
import pexpect
|
|
"""This expects for "string", with timeout & EOF being test fails."""
|
|
try:
|
|
self.child.expect_exact(string)
|
|
except pexpect.EOF:
|
|
self.fail("Got EOF waiting for '%s'" % (string))
|
|
except pexpect.TIMEOUT:
|
|
self.fail("Timed out waiting for '%s'" % (string))
|
|
|
|
@expectedFailureAll(
|
|
oslist=["windows"],
|
|
bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
|
|
def test_completion(self):
|
|
self.setTearDownCleanup()
|
|
|
|
import pexpect
|
|
exe = self.getBuildArtifact("a.out")
|
|
prompt = "(lldb) "
|
|
|
|
self.child = pexpect.spawn(
|
|
'%s %s %s %s' %
|
|
(lldbtest_config.lldbExec, self.lldbOption, "", exe))
|
|
|
|
self.expect_string(prompt)
|
|
# Start tab completion, go to the next page and then display all with 'a'.
|
|
self.child.send("\t\ta")
|
|
self.expect_string("register")
|
|
|
|
# Try tab completing regi to register.
|
|
self.child.send("regi\t")
|
|
self.expect_string(prompt + "register")
|
|
self.child.send("\n")
|
|
|
|
# Start tab completion and abort showing more commands with 'n'.
|
|
self.child.send("\t")
|
|
self.expect_string("More (Y/n/a)")
|
|
self.child.send("n")
|
|
self.expect_string(prompt)
|
|
|
|
# Shouldn't crash or anything like that.
|
|
self.child.send("regoinvalid\t")
|
|
self.expect_string(prompt)
|
|
|
|
self.deletePexpectChild()
|