To fit the style guide: https://llvm.org/docs/CodingStandards.html#error-and-warning-messages I found these with: * Find `(\.AppendErrorWithFormat\(([\s\r\n]+)?"(?:(?:\\.|[^"\\])*))\."` and replace with `$1"` using Visual Studio Code. * Putting a call to `validate_diagnostic` in `AppendErrorWithFormat`. * Manual inspection. Note that this change *does not* include a call to `validate_diagnostic` because I do not know what's going to crash on platforms that I haven't tested on.
36 lines
1.3 KiB
Python
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")
|