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 11 12class UnknownCommandTestCase(TestBase): 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( 22 result.GetError(), "Ambiguous command 'g'. Possible matches:" 23 ) 24 self.assertRegexpMatches(result.GetError(), "gui") 25 self.assertRegexpMatches(result.GetError(), "gdb-remote") 26 self.assertEqual(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.assertEqual(result.GetError(), "error: 'qbert' is not a valid command.\n") 37