brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 6d2ce2b Raw
34 lines · python
1"""2Test how lldb reacts to wrong commands3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class UnknownCommandTestCase(TestBase):12    @no_debug_info_test13    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_test26    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