Files
llvm-project/lldb/test/API/functionalities/wrong_commands/TestWrongCommands.py
Jonas Devlieghere 29760ce5d9 [lldb] Fix capitalization in ambiguous command error (#171519)
We follow LLVM's style guide for diagnostics, which instructs to start
the first sentence with a lowercase letter, and finish the last sentence
without a period, if it would end in one otherwise.
2025-12-09 16:02:40 -08:00

36 lines
1.3 KiB
Python

"""
Test how lldb reacts to wrong commands
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class UnknownCommandTestCase(TestBase):
@no_debug_info_test
def test_ambiguous_command(self):
command_interpreter = self.dbg.GetCommandInterpreter()
self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
result = lldb.SBCommandReturnObject()
command_interpreter.HandleCommand("g", result)
self.assertFalse(result.Succeeded())
self.assertRegex(
result.GetError(), "error: ambiguous command 'g'. Possible matches:"
)
self.assertRegex(result.GetError(), "gui")
self.assertRegex(result.GetError(), "gdb-remote")
self.assertEqual(1, result.GetError().count("gdb-remote"))
@no_debug_info_test
def test_unknown_command(self):
command_interpreter = self.dbg.GetCommandInterpreter()
self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER)
result = lldb.SBCommandReturnObject()
command_interpreter.HandleCommand("qbert", result)
self.assertFalse(result.Succeeded())
self.assertEqual(result.GetError(), "error: 'qbert' is not a valid command.\n")