2 Test the command history mechanism
5 from __future__ import print_function
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
15 class CommandHistoryTestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
20 def test_history(self):
21 self.runCmd('command history --clear', inHistory=False)
22 self.runCmd('breakpoint list', check=False, inHistory=True) # 0
23 self.runCmd('register read', check=False, inHistory=True) # 1
24 self.runCmd('apropos hello', check=False, inHistory=True) # 2
25 self.runCmd('memory write', check=False, inHistory=True) # 3
26 self.runCmd('log list', check=False, inHistory=True) # 4
27 self.runCmd('disassemble', check=False, inHistory=True) # 5
28 self.runCmd('expression 1', check=False, inHistory=True) # 6
30 'type summary list -w default',
33 self.runCmd('version', check=False, inHistory=True) # 8
34 self.runCmd('frame select 1', check=False, inHistory=True) # 9
37 "command history -s 3 -c 3",
44 self.expect("command history -s 3 -e 3", inHistory=True,
45 substrs=['3: memory write'])
48 "command history -s 6 -e 7",
52 '7: type summary list -w default'])
54 self.expect("command history -c 2", inHistory=True,
55 substrs=['0: breakpoint list', '1: register read'])
57 self.expect("command history -e 3 -c 1", inHistory=True,
58 substrs=['3: memory write'])
61 "command history -e 2",
69 "command history -s 12",
72 '12: command history -s 6 -e 7',
73 '13: command history -c 2',
74 '14: command history -e 3 -c 1',
75 '15: command history -e 2',
76 '16: command history -s 12'])
79 "command history -s end -c 3",
82 '15: command history -e 2',
83 '16: command history -s 12',
84 '17: command history -s end -c 3'])
87 "command history -s end -e 15",
90 '15: command history -e 2',
91 '16: command history -s 12',
92 '17: command history -s end -c 3',
93 'command history -s end -e 15'])
95 self.expect("command history -s 5 -c 1", inHistory=True,
96 substrs=['5: disassemble'])
98 self.expect("command history -c 1 -s 5", inHistory=True,
99 substrs=['5: disassemble'])
101 self.expect("command history -c 1 -e 3", inHistory=True,
102 substrs=['3: memory write'])
105 "command history -c 1 -e 3 -s 5",
108 substrs=['error: --count, --start-index and --end-index cannot be all specified in the same invocation'])