xref: /llvm-project-15.0.7/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py (revision bb09ef95)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1"""
2Test how lldb reacts to wrong commands
3"""
4
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11class UnknownCommandTestCase(TestBase):
12
13    mydir = TestBase.compute_mydir(__file__)
14
15    @no_debug_info_test
16    def test_ambiguous_command(self):
17        command_interpreter = self.dbg.GetCommandInterpreter()
18        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
19        result = lldb.SBCommandReturnObject()
20
21        command_interpreter.HandleCommand("g", result)
22        self.assertFalse(result.Succeeded())
23        self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. Possible matches:")
24        self.assertRegexpMatches(result.GetError(), "gui")
25        self.assertRegexpMatches(result.GetError(), "gdb-remote")
26        self.assertEquals(1, result.GetError().count("gdb-remote"))
27
28    @no_debug_info_test
29    def test_unknown_command(self):
30        command_interpreter = self.dbg.GetCommandInterpreter()
31        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
32        result = lldb.SBCommandReturnObject()
33
34        command_interpreter.HandleCommand("qbert", result)
35        self.assertFalse(result.Succeeded())
36        self.assertEquals(result.GetError(), "error: 'qbert' is not a valid command.\n")
37

served by {OpenGrok

Last Index Update: Tue Oct 21 18:42:31 GMT 2025