99 lines · python
1import lldb2from lldbsuite.test.decorators import *3from lldbsuite.test.lldbtest import *4from lldbsuite.test import lldbutil5from lldbsuite.test.lldbpexpect import PExpectTest6 7 8class EditlineCompletionsTest(PExpectTest):9 @skipIfAsan10 @skipIfEditlineSupportMissing11 def test_completion_truncated(self):12 """Test that the completion is correctly truncated."""13 self.launch(dimensions=(10, 20))14 self.child.send("_regexp-\t")15 self.child.expect(" _regexp-a...")16 self.child.expect(" _regexp-b...")17 18 @skipIfAsan19 @skipIfEditlineSupportMissing20 def test_description_truncated(self):21 """Test that the description is correctly truncated."""22 self.launch(dimensions=(10, 70))23 self.child.send("_regexp-\t")24 self.child.expect(25 " _regexp-attach -- Attach to process by ID or name."26 )27 self.child.expect(28 " _regexp-break -- Set a breakpoint using one of several..."29 )30 31 @skipIfAsan32 @skipIfEditlineSupportMissing33 def test_separator_omitted(self):34 """Test that the separated is correctly omitted."""35 self.launch(dimensions=(10, 32))36 self.child.send("_regexp-\t")37 self.child.expect(" _regexp-attach \r\n")38 self.child.expect(" _regexp-break \r\n")39 40 @skipIfAsan41 @skipIfEditlineSupportMissing42 def test_separator(self):43 """Test that the separated is correctly printed."""44 self.launch(dimensions=(10, 33))45 self.child.send("_regexp-\t")46 self.child.expect(" _regexp-attach -- A...")47 self.child.expect(" _regexp-break -- S...")48 49 @skipIfAsan50 @skipIfEditlineSupportMissing51 def test_multiline_description(self):52 """Test that multi-line descriptions are correctly padded and truncated."""53 self.launch(dimensions=(10, 72))54 self.child.send("k\t")55 self.child.expect(56 " kdp-remote -- Connect to a process via remote KDP server."57 )58 self.child.expect(59 " If no UDP port is specified, port 41139 is assu..."60 )61 self.child.expect(62 " kdp-remote is an abbreviation for 'process conn..."63 )64 self.child.expect(" kill -- Terminate the current target process.")65 66 @skipIfAsan67 @skipIfEditlineSupportMissing68 def test_completion_pagination(self):69 """Test that we use the terminal height for pagination."""70 self.launch(dimensions=(10, 30))71 self.child.send("_regexp-\t")72 self.child.expect("Available completions:")73 self.child.expect(" _regexp-attach")74 self.child.expect(" _regexp-break")75 self.child.expect(" _regexp-bt")76 self.child.expect(" _regexp-display")77 self.child.expect(" _regexp-down")78 self.child.expect(" _regexp-env")79 self.child.expect(" _regexp-jump")80 self.child.expect("More")81 82 @skipIfAsan83 @skipIfEditlineSupportMissing84 def test_completion_multiline_pagination(self):85 """Test that we use the terminal height for pagination and account for multi-line descriptions."""86 self.launch(dimensions=(6, 72))87 self.child.send("k\t")88 self.child.expect("Available completions:")89 self.child.expect(90 " kdp-remote -- Connect to a process via remote KDP server."91 )92 self.child.expect(93 " If no UDP port is specified, port 41139 is assu..."94 )95 self.child.expect(96 " kdp-remote is an abbreviation for 'process conn..."97 )98 self.child.expect("More")99