Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 1 | """Test lldb help command.""" |
| 2 | |
| 3 | import lldb |
| 4 | import unittest |
| 5 | |
| 6 | class TestHelpCommand(unittest.TestCase): |
| 7 | |
| 8 | def setUp(self): |
| 9 | self.debugger = lldb.SBDebugger.Create() |
| 10 | self.debugger.SetAsync(True) |
| 11 | self.ci = self.debugger.GetCommandInterpreter() |
| 12 | if not self.ci: |
| 13 | raise Exception('Could not get the command interpreter') |
| 14 | |
| 15 | def tearDown(self): |
| 16 | pass |
| 17 | |
| 18 | def test_simplehelp(self): |
| 19 | """A simple test of 'help' command and its output.""" |
| 20 | res = lldb.SBCommandReturnObject() |
Johnny Chen | 7e363f5 | 2010-06-28 20:55:57 +0000 | [diff] [blame] | 21 | self.ci.HandleCommand("help", res) |
| 22 | self.assertTrue(res.Succeeded()) |
| 23 | self.assertTrue(res.GetOutput().startswith( |
| 24 | 'The following is a list of built-in, permanent debugger commands')) |
| 25 | #print res.GetOutput() |
| 26 | |
| 27 | def test_help_should_not_hang_emacsshell(self): |
| 28 | """'set term-width 0' should not hang the help command.""" |
| 29 | res = lldb.SBCommandReturnObject() |
| 30 | self.ci.HandleCommand("set term-width 0", res) |
| 31 | self.assertTrue(res.Succeeded()) |
| 32 | self.ci.HandleCommand("help", res) |
Johnny Chen | 9320d4a | 2010-06-25 23:15:47 +0000 | [diff] [blame] | 33 | self.assertTrue(res.Succeeded()) |
| 34 | self.assertTrue(res.GetOutput().startswith( |
| 35 | 'The following is a list of built-in, permanent debugger commands')) |
| 36 | #print res.GetOutput() |
| 37 | |
| 38 | |
| 39 | if __name__ == '__main__': |
| 40 | unittest.main() |