1""" 2Test how lldb reacts to wrong commands 3""" 4 5import lldb 6from lldbsuite.test.decorators import * 7from lldbsuite.test.lldbtest import * 8from lldbsuite.test import lldbutil 9 10 11class UnknownCommandTestCase(TestBase): 12 @no_debug_info_test 13 def test_ambiguous_command(self): 14 command_interpreter = self.dbg.GetCommandInterpreter() 15 self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) 16 result = lldb.SBCommandReturnObject() 17 18 command_interpreter.HandleCommand("g", result) 19 self.assertFalse(result.Succeeded()) 20 self.assertRegex(result.GetError(), "Ambiguous command 'g'. Possible matches:") 21 self.assertRegex(result.GetError(), "gui") 22 self.assertRegex(result.GetError(), "gdb-remote") 23 self.assertEqual(1, result.GetError().count("gdb-remote")) 24 25 @no_debug_info_test 26 def test_unknown_command(self): 27 command_interpreter = self.dbg.GetCommandInterpreter() 28 self.assertTrue(command_interpreter, VALID_COMMAND_INTERPRETER) 29 result = lldb.SBCommandReturnObject() 30 31 command_interpreter.HandleCommand("qbert", result) 32 self.assertFalse(result.Succeeded()) 33 self.assertEqual(result.GetError(), "error: 'qbert' is not a valid command.\n") 34