1""" 2Test that the lldb editline handling is configured correctly. 3""" 4 5 6 7import lldb 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11from lldbsuite.test.lldbpexpect import PExpectTest 12 13 14class EditlineTest(PExpectTest): 15 16 mydir = TestBase.compute_mydir(__file__) 17 18 @skipIfAsan 19 @skipIfEditlineSupportMissing 20 def test_left_right_arrow(self): 21 """Test that ctrl+left/right arrow navigates words correctly. 22 23 Note: just sending escape characters to pexpect and checking the buffer 24 doesn't work well, so we run real commands. We want to type 25 "help command" while exercising word-navigation, so type it as below, 26 where [] indicates cursor position. 27 28 1. Send "el rint" -> "el rint[]" 29 2. Ctrl+left once -> "el []rint" 30 3. Send "p" -> "el p[]rint" 31 4. Ctrl+left twice -> "[]el print" 32 5. Send "h" -> "h[]el print" 33 6. Ctrl+right -> "hel[] print" 34 7. Send "p" -> "help print" 35 """ 36 self.launch() 37 38 escape_pairs = [ 39 ("\x1b[1;5D", "\x1b[1;5C"), 40 ("\x1b[5D", "\x1b[5C"), 41 ("\x1b\x1b[D", "\x1b\x1b[C"), 42 ] 43 for (l_escape, r_escape) in escape_pairs: 44 self.expect("el rint{L}p{L}{L}h{R}p".format( 45 L=l_escape, R=r_escape), substrs=["Syntax: print"]) 46 47 self.quit() 48