aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/terminal/TestEditlineCompletions.py
blob: b4ea0f39ec10c5c339b4ac51e090f4ea2352f003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbpexpect import PExpectTest


class EditlineCompletionsTest(PExpectTest):
    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_completion_truncated(self):
        """Test that the completion is correctly truncated."""
        self.launch(dimensions=(10, 20))
        self.child.send("_regexp-\t")
        self.child.expect("        _regexp-a...")
        self.child.expect("        _regexp-b...")

    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_description_truncated(self):
        """Test that the description is correctly truncated."""
        self.launch(dimensions=(10, 70))
        self.child.send("_regexp-\t")
        self.child.expect(
            "        _regexp-attach    -- Attach to process by ID or name."
        )
        self.child.expect(
            "        _regexp-break     -- Set a breakpoint using one of several..."
        )

    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_separator_omitted(self):
        """Test that the separated is correctly omitted."""
        self.launch(dimensions=(10, 32))
        self.child.send("_regexp-\t")
        self.child.expect("        _regexp-attach   \r\n")
        self.child.expect("        _regexp-break    \r\n")

    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_separator(self):
        """Test that the separated is correctly printed."""
        self.launch(dimensions=(10, 33))
        self.child.send("_regexp-\t")
        self.child.expect("        _regexp-attach    -- A...")
        self.child.expect("        _regexp-break     -- S...")

    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_multiline_description(self):
        """Test that multi-line descriptions are correctly padded and truncated."""
        self.launch(dimensions=(10, 72))
        self.child.send("k\t")
        self.child.expect(
            "        kdp-remote -- Connect to a process via remote KDP server."
        )
        self.child.expect(
            "                      If no UDP port is specified, port 41139 is assu..."
        )
        self.child.expect(
            "                      kdp-remote is an abbreviation for 'process conn..."
        )
        self.child.expect("        kill       -- Terminate the current target process.")

    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_completion_pagination(self):
        """Test that we use the terminal height for pagination."""
        self.launch(dimensions=(10, 30))
        self.child.send("_regexp-\t")
        self.child.expect("Available completions:")
        self.child.expect("        _regexp-attach")
        self.child.expect("        _regexp-break")
        self.child.expect("        _regexp-bt")
        self.child.expect("        _regexp-display")
        self.child.expect("        _regexp-down")
        self.child.expect("        _regexp-env")
        self.child.expect("        _regexp-jump")
        self.child.expect("More")

    @skipIfAsan
    @skipIfEditlineSupportMissing
    def test_completion_multiline_pagination(self):
        """Test that we use the terminal height for pagination and account for multi-line descriptions."""
        self.launch(dimensions=(6, 72))
        self.child.send("k\t")
        self.child.expect("Available completions:")
        self.child.expect(
            "        kdp-remote -- Connect to a process via remote KDP server."
        )
        self.child.expect(
            "                      If no UDP port is specified, port 41139 is assu..."
        )
        self.child.expect(
            "                      kdp-remote is an abbreviation for 'process conn..."
        )
        self.child.expect("More")