blob: 1989eb571515be479ed332a02886b9360f2e1a5b [file] [log] [blame]
Johnny Chen068d9a82010-08-02 21:26:00 +00001"""
2Test lldb help command.
3
4See also CommandInterpreter::OutputFormattedHelpText().
5"""
Johnny Chen64845fd2010-06-25 23:15:47 +00006
Johnny Chend0ab3cd2010-07-01 00:18:39 +00007import os, time
Johnny Chen75e28f92010-08-05 23:42:46 +00008import unittest2
Johnny Chena1affab2010-07-03 03:41:59 +00009import lldb
Johnny Chend85dae52010-08-09 23:44:24 +000010from lldbtest import *
Johnny Chen64845fd2010-06-25 23:15:47 +000011
Johnny Chend85dae52010-08-09 23:44:24 +000012class TestHelpCommand(TestBase):
Johnny Chen909e5a62010-07-01 22:52:57 +000013
Johnny Chena1affab2010-07-03 03:41:59 +000014 mydir = "help"
Johnny Chen64845fd2010-06-25 23:15:47 +000015
16 def test_simplehelp(self):
17 """A simple test of 'help' command and its output."""
18 res = lldb.SBCommandReturnObject()
Johnny Chen6b8fc822010-06-28 20:55:57 +000019 self.ci.HandleCommand("help", res)
20 self.assertTrue(res.Succeeded())
21 self.assertTrue(res.GetOutput().startswith(
Johnny Chend85dae52010-08-09 23:44:24 +000022 'The following is a list of built-in, permanent debugger commands'),
23 CMD_MSG('help'))
Johnny Chen6b8fc822010-06-28 20:55:57 +000024
25 def test_help_should_not_hang_emacsshell(self):
Johnny Chen16b97472010-06-29 23:17:15 +000026 """Command 'set term-width 0' should not hang the help command."""
Johnny Chen6b8fc822010-06-28 20:55:57 +000027 res = lldb.SBCommandReturnObject()
28 self.ci.HandleCommand("set term-width 0", res)
Johnny Chend85dae52010-08-09 23:44:24 +000029 self.assertTrue(res.Succeeded(), CMD_MSG('set term-width 0'))
Johnny Chen6b8fc822010-06-28 20:55:57 +000030 self.ci.HandleCommand("help", res)
Johnny Chen64845fd2010-06-25 23:15:47 +000031 self.assertTrue(res.Succeeded())
32 self.assertTrue(res.GetOutput().startswith(
Johnny Chend85dae52010-08-09 23:44:24 +000033 'The following is a list of built-in, permanent debugger commands'),
34 CMD_MSG('help'))
Johnny Chen64845fd2010-06-25 23:15:47 +000035
36
37if __name__ == '__main__':
Johnny Chen88f83042010-08-05 21:23:45 +000038 import atexit
Johnny Chen1bfbd412010-06-29 19:44:16 +000039 lldb.SBDebugger.Initialize()
Johnny Chen88f83042010-08-05 21:23:45 +000040 atexit.register(lambda: lldb.SBDebugger.Terminate())
Johnny Chen75e28f92010-08-05 23:42:46 +000041 unittest2.main()