1"""
2Test completion for multiline expressions.
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test.lldbpexpect import PExpectTest
9
10class MultilineCompletionTest(PExpectTest):
11
12    mydir = TestBase.compute_mydir(__file__)
13
14    # PExpect uses many timeouts internally and doesn't play well
15    # under ASAN on a loaded machine..
16    @skipIfAsan
17    @skipIfRemote  # test is written to explicitly "run" the binary
18    @skipIfEditlineSupportMissing
19    def test_basic_completion(self):
20        """Test that we can complete a simple multiline expression"""
21        self.build()
22
23        self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,500))
24        self.expect("b main", substrs=["Breakpoint 1", "address ="])
25        self.expect("run", substrs=["stop reason ="])
26
27        self.child.sendline("expr")
28        self.child.expect_exact("terminate with an empty line to evaluate")
29        self.child.send("to_\t")
30        self.child.expect_exact("to_complete")
31
32        self.child.send("\n\n")
33        self.expect_prompt()
34
35        self.quit()
36