xref: /llvm-project/lldb/test/API/functionalities/abbreviation/TestCommonShortSpellings.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
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
7import lldb
8from lldbsuite.test.decorators import *
9from lldbsuite.test.lldbtest import *
10from lldbsuite.test import lldbutil
11
12
13class CommonShortSpellingsTestCase(TestBase):
14    @no_debug_info_test
15    def test_abbrevs2(self):
16        command_interpreter = self.dbg.GetCommandInterpreter()
17        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
18        result = lldb.SBCommandReturnObject()
19
20        abbrevs = [
21            ("br s", "breakpoint set"),
22            ("disp", "_regexp-display"),  # a.k.a., 'display'
23            ("di", "disassemble"),
24            ("dis", "disassemble"),
25            ("ta st a", "target stop-hook add"),
26            ("fr v", "frame variable"),
27            ("f 1", "frame select 1"),
28            ("ta st li", "target stop-hook list"),
29        ]
30
31        for short_val, long_val in abbrevs:
32            command_interpreter.ResolveCommand(short_val, result)
33            self.assertTrue(result.Succeeded())
34            self.assertEqual(long_val, result.GetOutput())
35