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    @no_debug_info_test
17    def test_abbrevs2(self):
18        command_interpreter = self.dbg.GetCommandInterpreter()
19        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
20        result = lldb.SBCommandReturnObject()
21
22        abbrevs = [
23            ('br s', 'breakpoint set'),
24            ('disp', '_regexp-display'),  # a.k.a., 'display'
25            ('di', 'disassemble'),
26            ('dis', 'disassemble'),
27            ('ta st a', 'target stop-hook add'),
28            ('fr v', 'frame variable'),
29            ('f 1', 'frame select 1'),
30            ('ta st li', 'target stop-hook list'),
31        ]
32
33        for (short_val, long_val) in abbrevs:
34            command_interpreter.ResolveCommand(short_val, result)
35            self.assertTrue(result.Succeeded())
36            self.assertEqual(long_val, result.GetOutput())
37