1"""
2Test some lldb command abbreviations to make sure the common short spellings of
3many commands remain available even after we add/delete commands in the future.
4"""
5
6
7
8import lldb
9from lldbsuite.test.decorators import *
10from lldbsuite.test.lldbtest import *
11from lldbsuite.test import lldbutil
12
13
14class CommonShortSpellingsTestCase(TestBase):
15
16    mydir = TestBase.compute_mydir(__file__)
17
18    @no_debug_info_test
19    def test_abbrevs2(self):
20        command_interpreter = self.dbg.GetCommandInterpreter()
21        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
22        result = lldb.SBCommandReturnObject()
23
24        abbrevs = [
25            ('br s', 'breakpoint set'),
26            ('disp', '_regexp-display'),  # a.k.a., 'display'
27            ('di', 'disassemble'),
28            ('dis', 'disassemble'),
29            ('ta st a', 'target stop-hook add'),
30            ('fr v', 'frame variable'),
31            ('f 1', 'frame select 1'),
32            ('ta st li', 'target stop-hook list'),
33        ]
34
35        for (short_val, long_val) in abbrevs:
36            command_interpreter.ResolveCommand(short_val, result)
37            self.assertTrue(result.Succeeded())
38            self.assertEqual(long_val, result.GetOutput())
39