xref: /llvm-project-15.0.7/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py (revision 4cc8f2a0)
  • 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    @no_debug_info_test
14    def test_ambiguous_command(self):
15        command_interpreter = self.dbg.GetCommandInterpreter()
16        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
17        result = lldb.SBCommandReturnObject()
18
19        command_interpreter.HandleCommand("g", result)
20        self.assertFalse(result.Succeeded())
21        self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. Possible matches:")
22        self.assertRegexpMatches(result.GetError(), "gui")
23        self.assertRegexpMatches(result.GetError(), "gdb-remote")
24        self.assertEquals(1, result.GetError().count("gdb-remote"))
25
26    @no_debug_info_test
27    def test_unknown_command(self):
28        command_interpreter = self.dbg.GetCommandInterpreter()
29        self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
30        result = lldb.SBCommandReturnObject()
31
32        command_interpreter.HandleCommand("qbert", result)
33        self.assertFalse(result.Succeeded())
34        self.assertEquals(result.GetError(), "error: 'qbert' is not a valid command.\n")
35

served by {OpenGrok

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