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 @skipIfAsan 17 @skipIfEditlineSupportMissing 18 @skipIf(oslist=["linux"], archs=["arm", "aarch64"]) 19 def test_left_right_arrow(self): 20 """Test that ctrl+left/right arrow navigates words correctly. 21 22 Note: just sending escape characters to pexpect and checking the buffer 23 doesn't work well, so we run real commands. We want to type 24 "help command" while exercising word-navigation, so type it as below, 25 where [] indicates cursor position. 26 27 1. Send "el rint" -> "el rint[]" 28 2. Ctrl+left once -> "el []rint" 29 3. Send "p" -> "el p[]rint" 30 4. Ctrl+left twice -> "[]el print" 31 5. Send "h" -> "h[]el print" 32 6. Ctrl+right -> "hel[] print" 33 7. Send "p" -> "help print" 34 """ 35 self.launch() 36 37 escape_pairs = [ 38 ("\x1b[1;5D", "\x1b[1;5C"), 39 ("\x1b[5D", "\x1b[5C"), 40 ("\x1b\x1b[D", "\x1b\x1b[C"), 41 ] 42 for (l_escape, r_escape) in escape_pairs: 43 self.expect("el rint{L}p{L}{L}h{R}p".format( 44 L=l_escape, R=r_escape), substrs=["Syntax: print"]) 45 46 self.quit() 47